#include "function_graph_view.h" #include #include #include using namespace Poincare; namespace Shared { FunctionGraphView::FunctionGraphView(InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor, BannerView * bannerView, View * cursorView) : CurveView(graphRange, cursor, bannerView, cursorView), m_xLabels{}, m_yLabels{}, m_context(nullptr) { } void FunctionGraphView::drawRect(KDContext * ctx, KDRect rect) const { ctx->fillRect(rect, KDColorWhite); drawGrid(ctx, rect); drawAxes(ctx, rect, Axis::Horizontal); drawAxes(ctx, rect, Axis::Vertical); drawLabels(ctx, rect, Axis::Horizontal, true); drawLabels(ctx, rect, Axis::Vertical, true); } void FunctionGraphView::setContext(Context * context) { m_context = context; } Context * FunctionGraphView::context() const { return m_context; } char * FunctionGraphView::label(Axis axis, int index) const { return (axis == Axis::Horizontal ? (char *)m_xLabels[index] : (char *)m_yLabels[index]); } }