#ifndef Graph_h #define Graph_h #include #include "Ecran.h" #include "common.h" // Max series in graph #define MAX_SERIES 2 enum SCALE {ONE_SCALE, TWO_SCALES}; enum SCALE_MODE {DYNAMIC_SCALE, FIXED_SCALE}; enum CHART_TYPE {TYPE_BARCHART, TYPE_LINE, TYPE_FILL_LINE}; typedef struct { CHART_TYPE chart_type; uint16_t color; float data[max_readings]; int thickness; // if not barchart mode int readings; } Serie; typedef struct { String title; String x_title; String y_title; SCALE_MODE auto_scale; SCALE show_2_scales; float Y_Min[MAX_SERIES]; float Y_Max[MAX_SERIES]; int auto_scale_margin; // Sets the autoscale increment, so axis steps up in units of e.g. 3 int y_minor_axis; // 5 y-axis division markers //Draw the Y-axis scale int number_of_dashes; int nb_series; Serie series[MAX_SERIES]; } Graph_Param; class Graph { public: Graph(Ecran * ecran, Graph_Param gp); void draw(int readings, int x_pos, int y_pos, int gwidth, int gheight); //float DataArray[], int readings); public: Ecran * ecran; Graph_Param gp; }; #endif