ChartPlot.h 1.23 KB
Newer Older
1 2 3 4 5
#ifndef CHARTPLOT_H
#define CHARTPLOT_H

#include <qwt_plot.h>
#include <qwt_plot_grid.h>
Don Gagne's avatar
Don Gagne committed
6
#include <qwt_plot_curve.h>
7 8 9 10 11 12 13 14 15 16 17 18 19 20
#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 */
21
    QColor getColorForCurve(const QString &id);
22 23 24 25

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

26 27 28
public slots:

    /** @brief Generate coloring for this plot canvas based on current window theme */
29
    void styleChanged(bool styleIsDark);
30

31
protected:
32 33
    const static int numColors = 20;
    const static QColor baseColors[numColors];
Gus Grubba's avatar
Gus Grubba committed
34 35 36 37 38 39 40 41 42

    QList<QColor>                   _colors;         ///< Colormap for curves
    int                             _nextColorIndex; ///< Next index in color map
    QMap<QString, QwtPlotCurve* >   _curves;         ///< Plot curves
    QwtPlotGrid*                    _grid;           ///< Plot grid

    float _symbolWidth;  ///< Width of curve symbols in pixels
    float _curveWidth;   ///< Width of curve lines in pixels
    float _gridWidth;    ///< Width of gridlines in pixels
43 44 45
};

#endif // CHARTPLOT_H