ChartPlot.h 1.25 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef CHARTPLOT_H
#define CHARTPLOT_H

#include <qwt_plot.h>
#include <qwt_plot_grid.h>
#include "MainWindow.h"
#include "ScrollZoomer.h"

class ChartPlot : public QwtPlot
{
    Q_OBJECT
public:
    ChartPlot(QWidget *parent = NULL);
    virtual ~ChartPlot();

    /** @brief Get next color of color map */
    QColor getNextColor();

    /** @brief Get color for curve id */
20
    QColor getColorForCurve(const QString &id);
21 22 23 24

    /** @brief Reset color map */
    void shuffleColors();

25 26 27
public slots:

    /** @brief Generate coloring for this plot canvas based on current window theme */
28
    void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style);
29

30
protected:
31 32
    const static int numColors = 20;
    const static QColor baseColors[numColors];
33
    QList<QColor> colors;  ///< Colormap for curves
34
    int nextColorIndex;         ///< Next index in color map
35 36 37 38
    QMap<QString, QwtPlotCurve* > curves;  ///< Plot curves
    ScrollZoomer* zoomer;  ///< Zoomer class for widget
    QwtPlotGrid* grid;     ///< Plot grid

39 40 41 42
    float symbolWidth; ///< Width of curve symbols in pixels
    float curveWidth; ///< Width of curve lines in pixels
    float gridWidth; ///< Width of gridlines in pixels
    float zoomerWidth; ///< Width of zoomer selection box
43 44 45
};

#endif // CHARTPLOT_H