float y[20], x[20];
int i;
for(i=0;i<20;i++)
{
x[i]=i;
y[i]=2*sin((x[i]));
}
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 );
for(i=0;i<20;i++)
points<<QPointF(x[i],y[i]);//<<QPointF(x2,y2)<<QPointF(x3,y3)<<QPointF(x4,y4)<< QPointF(x5,y5);
curve->setSamples( points );
curve->attach(plot );
plot->replot();
plot->resize( 600, 400 );
plot->show();
float y[20], x[20];
int i;
for(i=0;i<20;i++)
{
x[i]=i;
y[i]=2*sin((x[i]));
}
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;
for(i=0;i<20;i++)
points<<QPointF(x[i],y[i]);//<<QPointF(x2,y2)<<QPointF(x3,y3)<<QPointF(x4,y4)<< QPointF(x5,y5);
curve->setSamples( points );
curve->attach(plot );
plot->replot();
plot->resize( 600, 400 );
plot->show();
To copy to clipboard, switch view to plain text mode
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();
}
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();
}
To copy to clipboard, switch view to plain text mode
Bookmarks