/*************************************************************************** * BGraph.h Graph plotter * T.Barnaby, BEAM Ltd, 2007-05-31 *************************************************************************** */ #ifndef BGraph_H #define BGraph_H 1 #include #include #include #include #include #include #include #include class BGraph; class BGraphPlot : public QWidget { public: BGraphPlot(QWidget* parent, BGraph* cp); protected: void resizeEvent(QResizeEvent* event); void paintEvent(QPaintEvent* event); private: BGraph* ocp; }; class BGraph: public QGrid { Q_OBJECT public: enum GainMode { AUTO, FIXED }; BGraph(QWidget* parent); ~BGraph(); void setData(BArray data); ///< Set Plot data void getData(BArray& data); ///< Get Plot data void setGrid(int xStep, int yStep); void setXLabel(BString label); void setYLabel(BString label); void setYRange(double min, double max); ///< Sets the YRange, optional void setXRange(double min, double max); ///< Sets the YRange, optional void setYLabelWidth(int width); void getXRange(double& min, double& max); void redraw(); ///< Re-draw the plot void drawLabels(); void drawGrid(); void drawPlot(); public slots: void clear(); ///< Clear the plot and all data private: double oxRangeMin; double oxRangeMax; double oyRangeMin; double oyRangeMax; double oyMinValue; double oxMaxValue; double oxMinValue; double oyMaxValue; BString oxLabel; BString oyLabel; BArray odata; ///< The data buffer int oxGridStep; int oyGridStep; QWidget* oyLabelBox; ///< The Y label widget QWidget* ocorner; ///< The Corner widget QWidget* oxLabelBox; ///< The X label widget QHBox* oplotFrame; ///< The frame around the plot BGraphPlot* oplot; ///< The actual plot QPointArray opoints; ////< Temporary array for polt updates QColor ocolor; ///< The graph draw colour }; #endif