Hi all,
I have implmented plotting signals using Qwt.
What I want to do is depending on the checkbox status, the current curve should appear or disappear.
I have read about
NoCurve
NoCurve
To copy to clipboard, switch view to plain text mode
but I am not able to make it work in my program.
I have the following lines for drawing curves(two signals):
#include <qwt_plot_canvas.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_scale_widget.h>
Time plot
::Timeplot (QWidget *parent
) {
int k;
QVector<QPen> vColor;
vColor.
append(QPen(Qt
::black));
vColor.
append(QPen(Qt
::red));
QVector<QwtPlotCurve*> pPlotCurveTime;
for (k=0; k< 2; k++)
{
pPlotCurveTime[k]->setPen(vColor[k%vColor.count()]);
}
/*--------- if Checkbox is on (set to true), run following lines of code ---------*/
for (k=0; k< 2; k++)
{
pPlotCurveTime[k]->setRawSamples((const T_DOUBLE*) pPlotData->pdTimeAxis, pPlotData->ppdSignal[k], pPlotData->iSignalMemoryLength);
}
}
#include <qwt_plot_canvas.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_scale_widget.h>
Time plot::Timeplot (QWidget *parent )
:QwtPlot(parent)
{
int k;
QVector<QPen> vColor;
vColor.append(QPen(Qt::black));
vColor.append(QPen(Qt::red));
QVector<QwtPlotCurve*> pPlotCurveTime;
for (k=0; k< 2; k++)
{
pPlotCurveTime[k]->setPen(vColor[k%vColor.count()]);
}
/*--------- if Checkbox is on (set to true), run following lines of code ---------*/
for (k=0; k< 2; k++)
{
pPlotCurveTime[k]->setRawSamples((const T_DOUBLE*) pPlotData->pdTimeAxis, pPlotData->ppdSignal[k], pPlotData->iSignalMemoryLength);
}
}
To copy to clipboard, switch view to plain text mode
Now, if the Checkbox is toggled off (set to false), then the above plotted curve should disappear (similar to NoCurve).
What should be done to achieve this goal?
Please help! Thanks.
Bookmarks