diff --git a/apps/graph/graph/graph_view.cpp b/apps/graph/graph/graph_view.cpp index 818013218..fbf6e132e 100644 --- a/apps/graph/graph/graph_view.cpp +++ b/apps/graph/graph/graph_view.cpp @@ -1,9 +1,19 @@ #include "graph_view.h" +constexpr KDColor kAxisColor = KDColorGray(0x0); +constexpr KDColor kMainGridColor = KDColorGray(0xCC); +constexpr KDColor kSecondaryGridColor = KDColorGray(0xEE); +constexpr int kNumberOfMainGridLines = 5; +constexpr int kNumberOfSecondaryGridLines = 5; + GraphView::GraphView() : View(), m_cursorView(CursorView()), - m_cursorPosition(KDPointZero) + m_cursorPosition(KDPointZero), + m_xMin(-2.0f), + m_xMax(2.0f), + m_yMin(-2.0f), + m_yMax(2.0f) { } @@ -30,29 +40,72 @@ void GraphView::layoutSubviews() { void GraphView::drawRect(KDRect rect) const { KDFillRect(rect, KDColorWhite); - KDCoordinate x_grid_step = m_frame.width/10; - KDCoordinate y_grid_step = m_frame.height/10; - KDColor gridColor = KDColorGray(0xEE); - for (KDCoordinate x=0; x