本文整理汇总了C++中QwtPlotCurve::setTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::setTitle方法的具体用法?C++ QwtPlotCurve::setTitle怎么用?C++ QwtPlotCurve::setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::setTitle方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populate
void Plot::populate()
{
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setMinorPen( Qt::black, 0, Qt::DashLine );
grid->enableXMin( true );
grid->attach( this );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle("Some Points");
curve->setPen( Qt::blue, 4 ),
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;
points << QPointF( 10.0, 4.4 )
<< QPointF( 100.0, 3.0 ) << QPointF( 200.0, 4.5 )
<< QPointF( 300.0, 6.8 ) << QPointF( 400.0, 7.9 )
<< QPointF( 500.0, 7.1 ) << QPointF( 600.0, 7.9 )
<< QPointF( 700.0, 7.1 ) << QPointF( 800.0, 5.4 )
<< QPointF( 900.0, 2.8 ) << QPointF( 1000.0, 3.6 );
curve->setSamples( points );
curve->attach( this );
}
示例2: initTmpPlotAndGL
void CentralWidget::initTmpPlotAndGL()
{
QwtPlot *plot = new QwtPlot(this);
plot->setTitle( "Plot Demo" );
plot->setCanvasBackground( Qt::white );
plot->setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( plot );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Some Points" );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QPolygonF points;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
curve->setSamples( points );
curve->attach( plot );
this->addTab(plot, tr("Tmp Plot"));
MyGLWidget *widget = new MyGLWidget(this);
this->addTab(widget, tr("Tmp OpenGL"));
}
示例3: main
int main(int argc, char *argv[])
{
/*const int L = 10;
fftw_complex *in;
fftw_complex *out;
gsl_sf_bessel_k0_scaled(0.684684);
fftw_plan p;
in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*L);
out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*L);
p = fftw_plan_dft_1d(L, in, out,FFTW_FORWARD,FFTW_MEASURE);
fftw_execute(p);
fftw_destroy_plan(p);
fftw_free(in);
fftw_free(out);
QApplication a(argc, argv);
Ekg w;
w.show();
qDebug() << "sdfsdfsd";
std::cout << "ALKO PROJEKT CPP CHLOSTA!";
return a.exec();*/
QApplication a( argc, argv );
QwtPlot plot;
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
plot.insertLegend( new QwtLegend() );
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( &plot );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Some Points" );
curve->setPen( Qt::blue, 4 ),
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;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
示例4: sampleFormatChanged
void MainWindow::sampleFormatChanged()
{
for (int i = 0; i < curves.size(); i++) {
curves[i].curve->detach();
delete curves[i].curve;
curves[i].data->clear();
delete curves[i].data;
}
curves.clear();
timeAxis.clear();
QList<sampleValue> sampleList = kwp.getSample();
int numSamples = settingsDialog->rate * settingsDialog->historySecs + 1;
timeAxis.clear();
for (int i = 0; i < numSamples; i++) {
timeAxis.prepend(-i / static_cast<double>(settingsDialog->rate));
}
int numColors = sizeof(colorList) / sizeof(QString);
for (int i = 0; i < sampleList.length(); i++) {
QwtPlotCurve* curve = new QwtPlotCurve;
QVector<double>* data = new QVector<double>();
data->reserve(numSamples+1);
data->fill(0, numSamples);
QColor curveColor;
curveColor.setNamedColor(colorList[i % numColors]);
int blockNum = sampleList.at(i).refs.at(0).blockNum;
int pos = sampleList.at(i).refs.at(0).pos;
blockLabels_t label = kwp.getBlockLabel(blockNum);
QString desc = label.desc[pos] + " " + label.subDesc[pos];
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setPen(curveColor);
curve->setTitle(desc);
curve->setRawSamples(timeAxis.constData(), data->constData(), numSamples);
curve->attach(ui->plot);
// set legend checked
QwtLegendItem *legendItem = qobject_cast<QwtLegendItem*>(ui->plot->legend()->find(curve));
if (legendItem) {
legendItem->setChecked(true);
}
curveAndData tmp;
tmp.curve = curve;
tmp.data = data;
curves.append(tmp);
}
}
示例5: scaleCurves
void LinePlot::scaleCurves(QwtPlotCurve *curve)
{
/// multiple curves based on units
const QwtPlotItemList &listPlotItem = m_qwtPlot->itemList();
QwtPlotCurve *plotCurve;
QwtPlotItemIterator itPlotItem;
int curveCount = numberOfCurves();
switch (curveCount)
{
case 0:
{
curve->setYAxis(QwtPlot::yLeft);
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
break;
}
case 1:
{
curve->setYAxis(QwtPlot::yRight);
m_qwtPlot->enableAxis(QwtPlot::yRight, true);
break;
}
default: //scale
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
// find min, max of all curves
// scale
int i;
for ( itPlotItem = listPlotItem.begin();itPlotItem!=listPlotItem.end();++itPlotItem)
{
if ( (*itPlotItem)->rtti() == QwtPlotItem::Rtti_PlotCurve)
{
plotCurve = (QwtPlotCurve*) (*itPlotItem);
if ((plotCurve->minYValue() != 0) || (plotCurve->maxYValue() != 1))
{
QwtArray<double> xData(plotCurve->dataSize());
QwtArray<double> yData(plotCurve->dataSize());
for (i = 0; i < plotCurve->dataSize(); i++)
{
xData[i] = plotCurve->x(i);
yData[i] = (plotCurve->y(i) - plotCurve->minYValue())/ (plotCurve->maxYValue() - plotCurve->minYValue());
}
// reset data
plotCurve->setTitle(plotCurve->title().text() + "[" + QString::number(plotCurve->minYValue()) + ", " + QString::number(plotCurve->maxYValue()) + "]");
plotCurve->setData(xData,yData);
}
}
}
break;
}
}
示例6: insertCurve
void Plot::insertCurve( const QString &title,
const QColor &color, const QPolygonF &points )
{
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( title );
curve->setPen( color, 2 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::white ), QPen( color, 2 ), QSize( 8, 8 ) );
curve->setSymbol( symbol );
curve->setSamples( points );
curve->attach( this );
}
示例7: pen
void
MainWindow::sampleSeriesAdded(int index)
{
SampleSeries series = adapter->getSampleSeries(index);
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setData(new SampleSeries(series));
curve->setTitle(SampleSeries::toString(series.unit()));
QPen pen(getColor(series.unit()));
pen.setWidth(3);
curve->setPen(pen);
ui->plot->enableAxis(curve->yAxis());
curve->attach(ui->plot);
}
示例8: ChangeSeriesTitle
void PlotWidget::ChangeSeriesTitle(QString oldTitle, QString newTitle)
{
QwtPlotCurve *c = _curves.value(oldTitle);
c->setTitle(newTitle);
//Replot();
}
示例9: onPropertyValueChanged
void QwtPlotPropertySetDialog::onPropertyValueChanged(QtProperty * property, const QVariant & value)
{
if(!m_enableSet)
return;
int id = m_property_id.getPropertyID(property);
if (id < ID_CurveIDBase)
{
switch(id)
{
case ID_PlotTitle:
m_plot->setTitle(value.toString());
return;
case ID_PlotFooter:
m_plot->setFooter(value.toString());
return;
case ID_PlotCanvasBackground:
m_plot->setCanvasBackground(QBrush(value.value<QColor>()));
return;
case ID_PlotEnableZoomerScroll:
m_plot->enableZoomerScroll(value.toBool());
return;
case ID_PlotAxisSet:
setAxisEnable(value.toInt());
return;
case ID_XBottomScale:
setAxisScaleDrawStyle(QwtPlot::xBottom,value);
return;
case ID_XTopScale:
setAxisScaleDrawStyle(QwtPlot::xTop,value);
return;
case ID_YLeftScale:
setAxisScaleDrawStyle(QwtPlot::yLeft,value);
return;
case ID_YRightScale:
setAxisScaleDrawStyle(QwtPlot::yRight,value);
return;
case ID_XBottomDateScaleType:
m_plot->setAxisDateFormat(QwtPlot::xBottom,ChartWave_qwt::AxisDateScaleType(value.toInt()));
return;
case ID_XTopDateScaleType:
m_plot->setAxisDateFormat(QwtPlot::xTop,ChartWave_qwt::AxisDateScaleType(value.toInt()));
return;
case ID_YLeftDateScaleType:
m_plot->setAxisDateFormat(QwtPlot::yLeft,ChartWave_qwt::AxisDateScaleType(value.toInt()));
return;
case ID_YRightDateScaleType:
m_plot->setAxisDateFormat(QwtPlot::yRight,ChartWave_qwt::AxisDateScaleType(value.toInt()));
return;
case ID_XBottomInterval:
case ID_XTopInterval:
case ID_YLeftInterval:
case ID_YRightInterval:
setAxisScale(id,value.toPointF());
return;
case ID_XBottomTitle:
case ID_XTopTitle:
case ID_YLeftTitle:
case ID_YRightTitle:
setAxisTitle(id,value.toString());
return;
case ID_XBottomLabelRotation:
case ID_XTopLabelRotation:
case ID_YLeftLabelRotation:
case ID_YRightLabelRotation:
setAxislabelRotation(id,value.toDouble());
return;
}
}
else
{
QwtPlotCurve* cur = getCurvePtr(id);
if(!cur)
return;
const int propertyID = getCurvePropertyID(id);
if (ID_CurveTitle == propertyID)
{
cur->setTitle(value.toString());
return;
}
QPen newPen(cur->pen());
switch (propertyID) {
case ID_CurveColore:
newPen.setColor(value.value<QColor>());
break;
case ID_CurveWidth:
newPen.setWidth(value.toInt());
break;
case ID_CurvePenStyle:
newPen.setStyle(order2penStyle(value.toInt()));
break;
}
cur->setPen(newPen);
}
}
示例10: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
string videoName = "static";
//
//*** Pixel variation error
// original video pixel variation (RMSE) reading
tic();
vector<double> RMSEO,framesO;
double avrRMSEO;
if(readPixelRMSE("/home/maelle/Desktop/Samples/Static/"+videoName+"/"+videoName+".avi",RMSEO,framesO,avrRMSEO)>0) return -1;
toc();
// fusion stabilized video pixel variation (RMSE) reading
tic();
vector<double> RMSEF,framesF;
double avrRMSEF;
if(readPixelRMSE("/home/maelle/Desktop/Samples/Static/"+videoName+"/"+videoName+"_stable_F.avi",RMSEF,framesF,avrRMSEF)>0) return -1;
toc();
// video processing stabilized video pixel variation (RMSE) reading
tic();
vector<double> RMSEV,framesV;
double avrRMSEV;
if(readPixelRMSE("/home/maelle/Desktop/Samples/Static/"+videoName+"/"+videoName+"_stable_VP.avi",RMSEV,framesV,avrRMSEV)>0) return -1;
toc();
// second round fusion stabilized video pixel variation (RMSE) reading
tic();
vector<double> RMSEF2,framesF2;
double avrRMSEF2;
if(readPixelRMSE("/home/maelle/Desktop/Samples/Static/"+videoName+"/"+videoName+"_stable2_F.avi",RMSEF2,framesF2,avrRMSEF2)>0) return -1;
toc();
// second round video processing stabilized video pixel variation (RMSE) reading
tic();
vector<double> RMSEV2,framesV2;
double avrRMSEV2;
if(readPixelRMSE("/home/maelle/Desktop/Samples/Static/"+videoName+"/"+videoName+"_stable2_VP.avi",RMSEV2,framesV2,avrRMSEV2)>0) return -1;
toc();
// plot first round
QwtPlot plotRMSE;
plotRMSE.setTitle("Root Mean Squared pixel variation per frame");
plotRMSE.setCanvasBackground(Qt::white);
plotRMSE.insertLegend(new QwtLegend());
plotRMSE.setAxisTitle(QwtPlot::yLeft,"RMSE (px)");
plotRMSE.setAxisTitle(QwtPlot::xBottom,"Frame");
QwtPlotMarker *mAO=new QwtPlotMarker();
mAO->setLinePen(QPen(Qt::darkBlue));
mAO->setLineStyle(QwtPlotMarker::HLine);
mAO->setValue(0,avrRMSEO);
mAO->attach(&plotRMSE);
QwtPlotMarker *mAF=new QwtPlotMarker();
mAF->setLinePen(QPen(Qt::darkRed));
mAF->setLineStyle(QwtPlotMarker::HLine);
mAF->setValue(0,avrRMSEF);
mAF->attach(&plotRMSE);
QwtPlotMarker *mAV=new QwtPlotMarker();
mAV->setLinePen(QPen(Qt::darkGreen));
mAV->setLineStyle(QwtPlotMarker::HLine);
mAV->setValue(0,avrRMSEV);
mAV->attach(&plotRMSE);
QwtPlotCurve *curveRMSEO = new QwtPlotCurve();
curveRMSEO->setTitle("Original");
curveRMSEO->setPen(Qt::blue,2);
curveRMSEO->setRenderHint(QwtPlotItem::RenderAntialiased,true);
curveRMSEO->setRawSamples(framesO.data(),RMSEO.data(),framesO.size());
curveRMSEO->attach(&plotRMSE);
QwtPlotCurve *curveRMSEF = new QwtPlotCurve();
curveRMSEF->setTitle("Fusion stabilized");
curveRMSEF->setPen(Qt::red,2);
curveRMSEF->setRenderHint(QwtPlotItem::RenderAntialiased,true);
curveRMSEF->setRawSamples(framesF.data(),RMSEF.data(),framesF.size());
curveRMSEF->attach(&plotRMSE);
QwtPlotCurve *curveRMSEV = new QwtPlotCurve();
curveRMSEV->setTitle("Video Processing stabilized");
curveRMSEV->setPen(Qt::green,2);
curveRMSEV->setRenderHint(QwtPlotItem::RenderAntialiased,true);
curveRMSEV->setRawSamples(framesV.data(),RMSEV.data(),framesV.size());
curveRMSEV->attach(&plotRMSE);
plotRMSE.resize(600,400);
plotRMSE.show();
// plot second round
QwtPlot plotRMSE2;
plotRMSE2.setTitle("Root Mean Squared pixel variation per frame (second round)");
plotRMSE2.setCanvasBackground(Qt::white);
plotRMSE2.insertLegend(new QwtLegend());
plotRMSE2.setAxisTitle(QwtPlot::yLeft,"RMSE (px)");
plotRMSE2.setAxisTitle(QwtPlot::xBottom,"Frame");
QwtPlotMarker *mAO2=new QwtPlotMarker();
mAO2->setLinePen(QPen(Qt::darkBlue));
mAO2->setLineStyle(QwtPlotMarker::HLine);
mAO2->setValue(0,avrRMSEO);
mAO2->attach(&plotRMSE2);
QwtPlotMarker *mAOF=new QwtPlotMarker();
mAOF->setLinePen(QPen(Qt::darkCyan));
mAOF->setLineStyle(QwtPlotMarker::HLine);
//.........这里部分代码省略.........
示例11: main
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QwtPlot plot;
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.setAxisScale( QwtPlot::xBottom, -1.0, 6.0 );
QwtLegend *legend = new QwtLegend();
legend->setDefaultItemMode( QwtLegendData::Checkable );
plot.insertLegend( legend );
for ( int i = 0; i < 4; i++ )
{
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
curve->setPen( Qt::blue );
QBrush brush;
QwtSymbol::Style style = QwtSymbol::NoSymbol;
QString title;
if ( i == 0 )
{
brush = Qt::magenta;
style = QwtSymbol::Path;
title = "Path";
}
else if ( i == 2 )
{
brush = Qt::red;
style = QwtSymbol::Graphic;
title = "Graphic";
}
else if ( i == 1 )
{
brush = Qt::yellow;
style = QwtSymbol::SvgDocument;
title = "Svg";
}
else if ( i == 3 )
{
brush = Qt::cyan;
style = QwtSymbol::Pixmap;
title = "Pixmap";
}
MySymbol *symbol = new MySymbol( style, brush );
curve->setSymbol( symbol );
curve->setTitle( title );
curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true );
curve->setLegendIconSize( QSize( 15, 18 ) );
QPolygonF points;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
points.translate( 0.0, i * 2.0 );
curve->setSamples( points );
curve->attach( &plot );
}
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
示例12: timerEvent
// Generate new values
void DataPlot::timerEvent(QTimerEvent *)
{
for (int k = 0; k < numberOfInputPorts; k++)
{
int timeout = 0;
int maxTimeout = 2;
Bottle *b = NULL;
while(b==NULL && timeout < maxTimeout)
{
b = inputPorts[k].read(false);
Time::delay(0.005);
timeout++;
}
if (timeout==maxTimeout)
{
if(VERBOSE) fprintf(stderr, "MESSAGE: Couldn't receive data. Going to put a zero! \n");
for(int i = 0; i < numberOfPlots[k]; i++)
{
d_y[k][i][PLOT_SIZE - 1] = 0;
for ( int j = 0; j < PLOT_SIZE - 1; j++ )
{
d_y[k][i][j] = d_y[k][i][j+1];
}
}
}
else
{
for(int i = 0; i < numberOfPlots[k]; i++)
{
Stamp stmp;
inputPorts[k].getEnvelope(stmp);
#ifdef ENABLE_REALTIME
if (stmp.isValid())
d_x_real_time[PLOT_SIZE - 1] = (stmp.getTime() - initialTime);
for ( int j = 0; j < PLOT_SIZE - 1; j++ )
{
if(realTime)
d_x_real_time[j] = d_x_real_time[j+1];
}
#endif
if (b==NULL)
d_y[k][i][PLOT_SIZE - 1] = 0;
else
if (b->size()-1 >= index[k][i])
{
d_y[k][i][PLOT_SIZE - 1] = b->get(index[k][i]).asDouble();
//if(VERBOSE) fprintf(stderr, "MESSAGE: Getting from port %d the index %d\n", k, index[k][i]);
}
// y moves from left to right:
// Shift y array right and assign new value to y[0].
for ( int j = 0; j < PLOT_SIZE - 1; j++ )
{
d_y[k][i][j] = d_y[k][i][j+1];
}
// update the display
//setAxisScale(QwtPlot::yLeft, min, max);
#ifdef ENABLE_REALTIME
if(numberAcquiredData==PLOT_SIZE && realTime)
{
if(VERBOSE) fprintf(stderr, "MESSAGE: switching to real time\n");
QwtPlotCurve *timeBasedCurve = new QwtPlotCurve("Data");
timeBasedCurve->attach(this);
timeBasedCurve->setRawData(d_x_real_time, d_y[k][i], PLOT_SIZE);
timeBasedCurve->setPen(coloredPens[k%NUMBER_OF_LIN][i%NUMBER_OF_COL]);
nonTimeBasedCurve[k][i].attach(NULL);
//Set title
char cTitle[256];
sprintf(cTitle, "Data(%d)", index[k][i]);
QwtText curveTitle(cTitle, QwtText::PlainText);
curveTitle.setFont(plotFont);
timeBasedCurve->setTitle(curveTitle);
}
#endif
}
}
}
if (acquire)
replot();
numberAcquiredData++;
//if(VERBOSE) fprintf(stderr, "Number of acquired data is %d\n", numberAcquiredData);
//QSize plotSize= this->sizeHint();
//if(VERBOSE) fprintf(stderr, "Hint is: hInt=%d, vInt=%d\n", plotSize.height(), plotSize.width());
static double before = Time::now();
double now = Time::now();
static double meanEffectiveTime = 0;
double currentEffectiveTime = (now - before)*1000.0;
if (numberAcquiredData >= 2)
meanEffectiveTime = (meanEffectiveTime*(numberAcquiredData-2) + currentEffectiveTime)/(numberAcquiredData-1);
//if(VERBOSE) fprintf(stderr, "Iteration %d: Current time is %f and mean is %f\n", numberAcquiredData, currentEffectiveTime, meanEffectiveTime);
//.........这里部分代码省略.........