PDA

View Full Version : implement NoCurve in Qwt plot according to checkbox toggle



uz_qt
29th August 2013, 15:34
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 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 )
: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);
}
}


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.

Uwe
30th August 2013, 00:52
See QwtPlotItem::setVisisble( bool )

Uwe