本文整理汇总了C++中QwtPlotCurve::setPen方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::setPen方法的具体用法?C++ QwtPlotCurve::setPen怎么用?C++ QwtPlotCurve::setPen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::setPen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DataPlot
OdomPlot::OdomPlot(QWidget *parent)
: DataPlot(parent) {
for (int i = 0; i < PLOT_SIZE; ++i){
motionData[i] = 0.0; visionData[i] = 0.0; combinedData[i] = 0.0;
}
for (int i = 0; i < PLOT_SIZE-1; ++i){
motionDiff[i] = 0.0; visionDiff[i] = 0.0; combinedDiff[i] = 0.0;
}
setTitle("Odometry turn");
QwtPlotCurve *fcurve = new QwtPlotCurve("Vision");
fcurve->attach(this);
fcurve->setRawData(t, visionDiff, PLOT_SIZE-1);
fcurve->setPen(QPen(Qt::red));
QwtPlotCurve *rcurve = new QwtPlotCurve("Motion");
rcurve->attach(this);
rcurve->setRawData(t, motionDiff, PLOT_SIZE-1);
rcurve->setPen(QPen(Qt::blue));
QwtPlotCurve *vcurve = new QwtPlotCurve("Combined");
vcurve->attach(this);
vcurve->setRawData(t, combinedDiff, PLOT_SIZE-1);
vcurve->setPen(QPen(Qt::green));
setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 2);
setAxisScale(QwtPlot::yLeft, -10, 10);
}
示例2: 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();
}
示例3: 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);
}
示例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: 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);
}
示例6: 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();
}
示例7: 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();
}
示例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: 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;
}
示例10: 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);
}
示例11: add
void Plot::add() {
Q_ASSERT(plotWidget && x && y && x->size()==y->size());
setIntervals();
for (int i = 0; i < intervals.size(); ++i) {
QwtPlotCurve *curve = new QwtPlotCurve(yLegend);
curve->setItemAttribute(QwtPlotItem::Legend, showLegend && i==0);
plotWidget->addCurve(curve);
if (type == Trace::Symbols) {
curve->setStyle(QwtPlotCurve::NoCurve);
}
if (type == Trace::Symbols || type == Trace::Both) {
Q_ASSERT(symbol);
curve->setSymbol(symbol);
}
if (type == Trace::Line || type == Trace::Both) {
curve->setPen(pen);
}
Interval iv = intervals[i];
int numPoints = iv.second - iv.first + 1;
if (numPoints <=0 )
Q_ASSERT(numPoints > 0);
curve->setSamples(x->data() + iv.first, y->data() + iv.first, numPoints);
}
}
示例12: insertCurve
void Plot::insertCurve(Qt::Orientation o,
const QColor &c, double base)
{
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setPen(c);
curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,
Qt::gray, c, QSize(8, 8)));
double x[10];
double y[sizeof(x) / sizeof(x[0])];
for ( uint i = 0; i < sizeof(x) / sizeof(x[0]); i++ )
{
double v = 5.0 + i * 10.0;
if ( o == Qt::Horizontal )
{
x[i] = v;
y[i] = base;
}
else
{
x[i] = base;
y[i] = v;
}
}
curve->setSamples(x, y, sizeof(x) / sizeof(x[0]));
curve->attach(this);
}
示例13: 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;
}
示例14: drawPoints
void Plot::drawPoints(){
QwtPlotCurve *curvePoints;
curvePoints = new QwtPlotCurve();
curvePoints->setPen(Qt::green);
curvePoints->setSamples(pointsArr);
curvePoints->attach(this);
this->replot();
}
示例15: 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();
}