当前位置: 首页>>代码示例>>C++>>正文


C++ QwtPlotCurve::setSamples方法代码示例

本文整理汇总了C++中QwtPlotCurve::setSamples方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::setSamples方法的具体用法?C++ QwtPlotCurve::setSamples怎么用?C++ QwtPlotCurve::setSamples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QwtPlotCurve的用法示例。


在下文中一共展示了QwtPlotCurve::setSamples方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: resamples

void Curves::resamples()
{
    setTitleX();
    foreach(int i, curves.keys()){
        if(i >= file->size()){
            delete curves.take(i);
        }
        else{
            QwtPlotCurve* curve = curves.value(i);
            curve->setSamples(
                file->samples(iX),
                file->samples(i)
            );
        }
    }

    ownerOuts->repaint();

    if(in){
        if(iIn >= file->size()){
            iIn = -1;
            delete in;
            in = NULL;
        }
        else{
            in->setSamples(
                file->samples(iX),
                file->samples(iIn)
            );
        }
        static_cast<InPlot*>(ownerIn)->clearInterval();
    }
}
开发者ID:rasmadeus,项目名称:CorAnalysis,代码行数:33,代码来源:Curves.cpp

示例2: 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);
    }

}
开发者ID:NielsHolst,项目名称:UniSim,代码行数:26,代码来源:plot.cpp

示例3: 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"));
}
开发者ID:zcwwcw,项目名称:QuickAnalysis,代码行数:26,代码来源:centralwidget.cpp

示例4: addCurveWithDataFromChannel

void RTVTPlotWindow::addCurveWithDataFromChannel(QVector<qreal> frequency, QVector<qreal> amplitude, unsigned int channel)
{
    QwtPlotCurve *curve = new QwtPlotCurve(QString("Channel " + QString::number(channel)));
    curve->setPen(selectPen());
    curve->setSamples(frequency, amplitude);
    curve->setAxes(QwtPlot::xBottom, QwtPlot::yLeft);
    curves << curve;

    channelStringList << curve->title().text();
    channelListStringModel->setStringList(channelStringList);
}
开发者ID:liqianggao,项目名称:RTVT,代码行数:11,代码来源:rtvtplotwindow.cpp

示例5: 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);
}
开发者ID:albore,项目名称:pandora,代码行数:30,代码来源:plot.cpp

示例6: 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 );
}
开发者ID:ChangSpivey,项目名称:GoldenCheetah,代码行数:26,代码来源:plot.cpp

示例7: 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;
}
开发者ID:adamb924,项目名称:AcousticWorkspace,代码行数:33,代码来源:plotviewwidget.cpp

示例8: 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);
}
开发者ID:mujicadiazr,项目名称:BDH,代码行数:29,代码来源:historicplot.cpp

示例9: drawDots

void Plot::drawDots(QVector< QVector<struct numCluster> > data, double n, double k, int index, int size, int number)
{
    int j, l;
    QPolygonF points;
    QwtPlotCurve *curve;

    QwtSymbol *symbol;

    points.clear();
    curve = new QwtPlotCurve();//QString("y = norm%1(x)").arg(index));
    curve->setItemAttribute(QwtPlotItem::Legend, false);
    curve->setStyle( QwtPlotCurve::Dots );
    for (l = 0; l < data.size(); l++){
        if (data[l][number].cluster == index){
            // ПЕРЕДЕЛАТЬ если возможно!!! Нужно, чтобы он печатал сразу для всех кластеров одной л.п.
            if (index == 0 && data[l][number].number < n){
                points << QPointF(data[l][number].number, 1);
            }else if (index == size - 1 && data[l][number].number > n){
                points << QPointF(data[l][number].number, 1);
            }else{
                points << QPointF(data[l][number].number, func_normal(data[l][number].number,n,k));
            }

            //std::cout << index << "data = " << data[l][i].number << std::endl;
        }
    }
    curve->setSamples(points);
    switch (index % 5){
    case 0:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::yellow ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 1:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::green ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 2:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::cyan ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 3:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::magenta ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    case 4:
        symbol = new QwtSymbol( QwtSymbol::Ellipse,
                                QBrush( Qt::gray ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
        curve->setSymbol(symbol);
        break;
    default:
        break;
    }
    curve->attach(this);
    this->replot();
}
开发者ID:kmi9work,项目名称:Fires,代码行数:59,代码来源:plot.cpp

示例10: drawPoints

void Plot::drawPoints(){
    QwtPlotCurve *curvePoints;
    curvePoints = new QwtPlotCurve();
    curvePoints->setPen(Qt::green);
    curvePoints->setSamples(pointsArr);
    curvePoints->attach(this);
    this->replot();
}
开发者ID:kmi9work,项目名称:Fires,代码行数:8,代码来源:plot.cpp

示例11: 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();
}
开发者ID:BiomedEKG,项目名称:ecg_holter,代码行数:58,代码来源:main.cpp

示例12: drawLine

void Plot::drawLine(QColor color){
    QwtPlotCurve *curvePoints;
    curvePoints = new QwtPlotCurve();
    curvePoints->setPen(color);
    curvePoints->setSamples(pointsArr);
    curvePoints->attach(this);
    this->replot();
    pointsArr.clear();
}
开发者ID:kmi9work,项目名称:Fires,代码行数:9,代码来源:plot.cpp

示例13: 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())
    );
}
开发者ID:pgarner,项目名称:libube,代码行数:9,代码来源:qwt.cpp

示例14: AddPlotData

void PlotWidget::AddPlotData(QString title, float plotData)
{
	if(!_curves.contains(title))
	{
		//QwtPointSeriesData *points = CreatePointSeriesFromArray(&plotData, 1);
		QwtPlotCurve *curve = new QwtPlotCurve(title);
		curve->setPen(QColor(255,0,0), 2.0);
		
		if(_showMarkers)
		{
			/*QwtSymbol *symbol1 = new QwtSymbol();
			symbol1->setStyle(QwtSymbol::Ellipse);
			symbol1->setPen(QColor(Qt::black));	
			symbol1->setSize(4);*/
			curve->setSymbol(GetDefaultMarker());
		}
		QVector<QPointF> nData;
		QPointF p(0, plotData);		
		nData.append(p);
		curve->setSamples(nData);

		curve->attach(_plot);		
		_curves.insert(title, curve);
	}
	else
	{		
		QwtPlotCurve *curve =_curves.value(title);
		QwtSeriesData<QPointF>* data = curve->data();
		int s = data->size();
		QPointF p(s, plotData);
		//QVector<QPointF> nData(s+1);
		QVector<QPointF> nData;
		for(int i = 0; i < s; i++)
		{			
			QPointF p(data->sample(i).x(), data->sample(i).y());
			nData.append(p);
		}
		nData.append(p);
		curve->setSamples(nData);
	}
	
	CheckNReplot();	
}
开发者ID:Funjy,项目名称:RF_60x_QuadView_w,代码行数:43,代码来源:PlotWidget.cpp

示例15: replotExpo

void ConfigStabilizationWidget::replotExpo(int value, QwtPlotCurve &curve)
{
    double x[EXPO_CURVE_POINTS_COUNT] = { 0 };
    double y[EXPO_CURVE_POINTS_COUNT] = { 0 };
    double factor = pow(EXPO_CURVE_CONSTANT, value);
    double step   = 1.0 / (EXPO_CURVE_POINTS_COUNT - 1);

    for (int i = 0; i < EXPO_CURVE_POINTS_COUNT; i++) {
        double val = i * step;
        x[i] = val * 100.0;
        y[i] = pow(val, factor) * 100.0;
    }
    curve.setSamples(x, y, EXPO_CURVE_POINTS_COUNT);
    ui->expoPlot->replot();
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:15,代码来源:configstabilizationwidget.cpp


注:本文中的QwtPlotCurve::setSamples方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。