Newer
Older
#ifndef INCREMENTALPLOT_H
#define INCREMENTALPLOT_H
#include <QTimer>
#include <qwt_array.h>
#include <qwt_plot.h>
#include <qwt_legend.h>
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <QMap>
#include "ScrollZoomer.h"
class QwtPlotCurve;
class CurveData
{
// A container class for growing data
public:
CurveData();
void append(double *x, double *y, int count);
int count() const;
int size() const;
const double *x() const;
const double *y() const;
private:
int d_count;
QwtArray<double> d_x;
QwtArray<double> d_y;
QTimer *d_timer;
int d_timerCount;
};
class IncrementalPlot : public QwtPlot
{
Q_OBJECT
public:
IncrementalPlot(QWidget *parent = NULL);
virtual ~IncrementalPlot();
/** @brief Get color map of this plot */
QList<QColor> IncrementalPlot::getColorMap();
/** @brief Get next color of color map */
QColor IncrementalPlot::getNextColor();
/** @brief Get color for curve id */
QColor IncrementalPlot::getColorForCurve(QString id);
public slots:
void appendData(QString key, double x, double y);
void appendData(QString key, double *x, double *y, int size);
void resetScaling();
void removeData();
/** @brief Show the plot legend */
void showLegend(bool show);
/** @brief Set new plot style */
void setStyleText(QString style);
protected:
QList<QColor> colors;
int nextColor;
ScrollZoomer* zoomer;
QwtLegend* legend;