5#include <QtGui/QDialog>
7#include <qwt_plot_curve.h>
9#include <qwt_plot_grid.h>
10#include <qwt_plot_panner.h>
25 newplot(QWidget *parent = 0):m_curve(NULL)
29 for (
int i = 0; i < 1000; i++)
35 this->setTitle(
"Winch 1");
36 this->setAxisTitle(QwtPlot::xBottom,
"Time/seconds");
37 this->setAxisTitle(QwtPlot::yLeft,
"Force [N]");
40 this->setAutoReplot(
true);
44 void appendData(
double x,
double y){
46 memmove(m_y, &m_y[1], 999 *
sizeof(
double));
47 memmove(m_x, &m_x[1], 999 *
sizeof(
double));
57 void TimeFrame(
const QString &mystring)
59 timeFrame =mystring.toDouble();
69 m_curve =
new QwtPlotCurve();
70 m_curve->setPen(QPen(QColor::fromRgb(255, 0, 0), 3));
71 m_curve->setRawSamples(m_x, m_y, 1000);
72 m_curve->attach(
this);
76 double max = *(std::max_element(&m_y[0], &m_y[999]));
77 double min = *(std::min_element(&m_y[0], &m_y[999]));
80 this->setAxisScale(QwtPlot::xBottom, m_x[999]-timeFrame, m_x[999]);
81 this->setAxisScale(QwtPlot::yLeft, min, max);
102 QwtPlotCurve *m_curve;