本文整理汇总了C++中QwtPlotCurve::setRenderHint方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::setRenderHint方法的具体用法?C++ QwtPlotCurve::setRenderHint怎么用?C++ QwtPlotCurve::setRenderHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::setRenderHint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTitle
Plot::Plot()
{
setTitle("A Simple QwtPlot Demonstration");
insertLegend(new QwtLegend(), QwtPlot::RightLegend);
// Set axis titles
setAxisTitle(xBottom, "x -->");
setAxisTitle(yLeft, "y -->");
// Insert new curves
QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cSin->setPen(QPen(Qt::red));
cSin->attach(this);
QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)");
#if QT_VERSION >= 0x040000
cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
cCos->setPen(QPen(Qt::blue));
cCos->attach(this);
// Create sin and cos data
const int nPoints = 100;
cSin->setData(SimpleData(::sin, nPoints));
cCos->setData(SimpleData(::cos, nPoints));
// Insert markers
// ...a horizontal line at y = 0...
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabel(QString::fromLatin1("y = 0"));
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(this);
// ...a vertical line at x = 2 * pi
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabel(QString::fromLatin1("x = 2 pi"));
mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
mX->setLabelOrientation(Qt::Vertical);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setLinePen(QPen(Qt::black, 0, Qt::DashDotLine));
mX->setXValue(2.0 * M_PI);
mX->attach(this);
}
示例2: addCurve
void HistoricPlot::addCurve(quint32 idVariable, std::vector<VariablePoint> data)
{
m_zoomer->setZoomBase(true);
QwtPlotCurve *c = new QwtPlotCurve(QString("id : %1").arg(idVariable));
c->setPen( QColor(qrand() % 255,qrand() % 255,qrand() % 255), 2 ),
c->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 5, 5 ) );
c->setSymbol( symbol );
QVector<VariablePoint> d2 = QVector<VariablePoint>::fromStdVector(data);
QVector<QPointF> cleanData;
for (int i = 0; i < data.size(); ++i) {
VariablePoint vp = d2.at(i);
qDebug() << QString("ID: %1, VALUE: %2").arg(vp.idVariable()).arg(vp.value().toDouble());
if (vp.value().type() == QVariant::Double)
cleanData.append(QPointF(QwtDate::toDouble(QDateTime::fromMSecsSinceEpoch(vp.timeStamp())),
vp.value().toDouble()));
else
cleanData.append(QPointF(QwtDate::toDouble(QDateTime::fromMSecsSinceEpoch(vp.timeStamp())),
(double)vp.value().toLongLong()));
}
c->setSamples(cleanData);
c->attach(this);
}
示例3: rebuild
void CDataPlot::rebuild(void)
{
for(int ci = 0; ci < m_portalCurveMap.count(); ++ci)
{
if(m_portalCurveMap.values().at(ci))
{
m_portalCurveMap.values().at(ci)->detach();
delete m_portalCurveMap.values().at(ci);
}
}
m_portalCurveMap.clear();
if(m_algTreeModel)
{
QList<CPortal*> portals = m_algTreeModel->checkedPortalList();
foreach(CPortal *portal, portals)
{
if(!portal) continue;
QwtPlotCurve *curve = new QwtPlotCurve(portal->caption());
curve->setData(new CCurveData(portal));
curve->setPen(portal->dataColor(), 3);
curve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
curve->attach(this);
m_portalCurveMap[portal] = curve;
}
}
refresh();
}
示例4: 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 );
}
示例5: AddPlotData
void PlotWidget::AddPlotData(QString title, float* plotData, int size, bool showMarkers)
{
if(_curves.contains(title))
return;
QwtPointSeriesData *points = CreatePointSeriesFromArray(plotData, size);
QwtPlotCurve *curve = new QwtPlotCurve(title);
curve->setData(points);
//Устанавливается цвет
curve->setPen(QColor(255,0,0), 2.0);
if(size < 1000)
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
//Marker
if(_showMarkers || showMarkers)
{
/*QwtSymbol *symbol1 = new QwtSymbol();
symbol1->setStyle(QwtSymbol::Ellipse);
symbol1->setPen(QColor(Qt::black));
symbol1->setSize(4);*/
curve->setSymbol(GetDefaultMarker());
}
//Кривая добавляется на график
curve->attach(_plot);
//Добавляется в список кривых
_curves.insert(title, curve);
//Область рисования перерисовывается, если включен автоматический режим
CheckNReplot();
}
示例6: QwtPlotCurve
QwtPlotCurve * PlotViewWidget::addCurveData(WaveformData *curveData, bool secondary, QColor col)
{
maWaveformData << curveData;
QwtPlotCurve *waveCurve = new QwtPlotCurve("dummy");
waveCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
waveCurve->setPen(QPen(col));
waveCurve->setSamples( curveData );
maCurves << waveCurve;
waveCurve->attach(this);
if( !mSecondaryAxis || maCurves.length() == 0 ) // no secondary axis or just one plot
{
replot();
setAxisScaleDiv(QwtPlot::yRight, axisScaleDiv(QwtPlot::yLeft));
replot();
}
else
{
if(secondary)
{
setAxisAutoScale(QwtPlot::yRight);
waveCurve->setYAxis(QwtPlot::yRight);
}
else
{
waveCurve->setYAxis(QwtPlot::yLeft);
}
}
repaint();
return waveCurve;
}
示例7: createCurve
//---------------------------------------------------------------------------
void JrkPlotDialog::createCurve(QString title, QColor cl, bool on, double scale)
{
QwtPlotCurve *curve;
QPen pen;
curve = new QwtPlotCurve(title);
pen.setColor(cl);
pen.setWidth(2);
curve->setPen(pen);
curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true);
curve->setRenderHint( QwtPlotCurve::RenderAntialiased, true);
#if 0
QwtSplineCurveFitter* curveFitter = new QwtSplineCurveFitter();
curveFitter->setSplineSize(500);
curve->setCurveFitter(curveFitter);
#endif
curve->attach(ui->jrkPlot);
showCurve(curve, on);
jrkdata.push_back(new JrkPlotData(curve, scale, samples()));
// qDebug("Scale: %f", scale);
}
示例8: 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"));
}
示例9: createCurve
QwtPlotCurve* Curves::createCurve(int i) const
{
QwtPlotCurve* curve = new QwtPlotCurve(file->header(i));
curve->setRenderHint(QwtPlotCurve::RenderAntialiased);
curve->setPen(QPen(QColor(rand() % 255, rand() % 255, rand() % 255), 2));
curve->setPaintAttribute(QwtPlotCurve::ClipPolygons);
return curve;
}
示例10: 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();
}
示例11: updatePlotCurves
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StatsGenPlotWidget::updatePlotCurves()
{
// qDebug() << "StatsGenPlotWidget::updatePlotCurves" << "\n";
//Loop over each entry in the table
QwtPlotCurve* curve = NULL;
// Delete all the plots
qint32 nRows = m_PlotCurves.count();
for (qint32 r = nRows - 1; r >= 0; --r)
{
curve = m_PlotCurves[r];
curve->detach();
m_PlotCurves.remove(r);
delete curve;
}
nRows = m_TableModel->rowCount();
float xMax = 0.0;
float yMax = 0.0;
for (qint32 r = 0; r < nRows; ++r)
{
if (r == m_PlotCurves.size())
{
curve = new QwtPlotCurve("");
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
QColor c = QColor(m_TableModel->getColor(r));
c.setAlpha(UIA::Alpha);
curve->setPen(QPen(c));
curve->attach(m_PlotView);
m_PlotCurves.append(curve);
}
else
{
curve = m_PlotCurves[r];
QColor c = QColor(m_TableModel->getColor(r));
c.setAlpha(UIA::Alpha);
curve->setPen(QPen(c));
}
switch(m_DistributionType)
{
case DREAM3D::DistributionType::Beta:
createBetaCurve(r, xMax, yMax);
break;
case DREAM3D::DistributionType::LogNormal:
createLogNormalCurve(r, xMax, yMax);
break;
case DREAM3D::DistributionType::Power:
createPowerCurve(r, xMax, yMax);
break;
default:
break;
}
}
m_PlotView->replot();
}
示例12: curve
void MQwt::curve(var iX, var iY, var iTitle)
{
QwtPlotCurve* curve = new QwtPlotCurve(iTitle.str());
curve->attach(mPlot);
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setSamples(
iX.ptr<double>(), iY.ptr<double>(), std::min(iX.size(), iY.size())
);
}
示例13: 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);
}
}
示例14: populate
void Plot::populate()
{
// Insert new curves
QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
cSin->setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
cSin->setPen(QPen(Qt::red));
cSin->attach(this);
QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)");
cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
cCos->setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
cCos->setPen(QPen(Qt::blue));
cCos->attach(this);
// Create sin and cos data
cSin->setData(new FunctionData(::sin));
cCos->setData(new FunctionData(::cos));
// Insert markers
// ...a horizontal line at y = 0...
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabel(QString::fromLatin1("y = 0"));
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(this);
// ...a vertical line at x = 2 * pi
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabel(QString::fromLatin1("x = 2 pi"));
mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
mX->setLabelOrientation(Qt::Vertical);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setLinePen(QPen(Qt::black, 0, Qt::DashDotLine));
mX->setXValue(2.0 * M_PI);
mX->attach(this);
}
示例15: initCurves
void Plot::initCurves()
{
QwtPointSeriesData* data = new QwtPointSeriesData();
m_manager.GetPointSeriesData(data, ResourceManager::MF_0);
QwtPlotCurve* curve = new QwtPlotCurve(tr("measured data"));
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setLegendAttribute(QwtPlotCurve::LegendNoAttribute);
curve->setPen(QPen(Qt::red));
curve->attach(this);
curve->setData(data);
}