plot->setTitle( "Plot Demo" );
plot->setCanvasBackground( Qt::white );
//plot->setAxisScale( QwtPlot::yLeft, 0.0, 20.0);
// plot->setAxisScale(QwtPlot::xBottom, 0.0, 20.0);
plot
->setAxisTitle
(QwtPlot::xBottom,
"X Axis");
plot
->setAxisTitle
(QwtPlot::yLeft,
"Y Axis");
grid->attach( plot );
grid->setPen( Qt::gray, 0.0, Qt::DotLine );
curve->setTitle( "Pixel Count" );
curve
->setPen
(QPen(Qt
::blue,
3,Qt
::SolidLine) );
curve
->setRenderHint
( QwtPlotItem::RenderAntialiased,
true);
curve->setSymbol(symbol );
curve->setSamples( points );
curve->attach( plot );
QList<QByteArray> read_data;
b1= process->readAllStandardOutput();
read_data=b1.split('\n');
int i=0, n=read_data.count();
float y[100000];
for( i=0; i<n; i++ )
{
result.remove(0,10);
qDebug("%s",result.toLatin1().data());
y[i]=result.toLatin1().toFloat();
// check wether curve is updated, if not do it here
plot->replot;
plot->show;
}
QwtPlot *plot=new QwtPlot();
plot->setTitle( "Plot Demo" );
plot->setCanvasBackground( Qt::white );
//plot->setAxisScale( QwtPlot::yLeft, 0.0, 20.0);
// plot->setAxisScale(QwtPlot::xBottom, 0.0, 20.0);
plot->insertLegend( new QwtLegend() );
plot->setAxisTitle(QwtPlot::xBottom, "X Axis");
plot->setAxisTitle(QwtPlot::yLeft, "Y Axis");
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( plot );
grid->setPen( Qt::gray, 0.0, Qt::DotLine );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Pixel Count" );
curve->setPen(QPen(Qt::blue, 3,Qt::SolidLine) );
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true);
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,QBrush(Qt::yellow),QPen(Qt::red,2),QSize(8,8));
curve->setSymbol(symbol );
QPolygonF points;
curve->setSamples( points );
curve->attach( plot );
QByteArray b1;
QList<QByteArray> read_data;
b1= process->readAllStandardOutput();
read_data=b1.split('\n');
int i=0, n=read_data.count();
float y[100000];
for( i=0; i<n; i++ )
{
QString result=read_data.at(i);
result.remove(0,10);
qDebug("%s",result.toLatin1().data());
y[i]=result.toLatin1().toFloat();
points << QPointF( i, y[i] );
// check wether curve is updated, if not do it here
plot->replot;
plot->show;
}
To copy to clipboard, switch view to plain text mode
Bookmarks