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


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

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


在下文中一共展示了QwtPlotCurve::setData方法的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);
}
开发者ID:376473984,项目名称:pvb,代码行数:49,代码来源:simple.cpp

示例2: 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();
}
开发者ID:Funjy,项目名称:RF_60x_QuadView_w,代码行数:27,代码来源:PlotWidget.cpp

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

示例4: drawFunc

void Plot::drawFunc(QVector params, double (*f)(double, QVector)){
    int j;
    QwtPlotCurve *curve = new QwtPlotCurve(QString("m: %1; a: %2").arg(m).arg(a));
    curve->setData(new FuncData(params, f));
    curve->attach(this);

    this->replot();
}
开发者ID:kmi9work,项目名称:Fires,代码行数:8,代码来源:plot.cpp

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

}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:54,代码来源:LinePlot.cpp

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

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

示例8: createCurve

QwtPlotCurve* PowerBarHistoryPlot::createCurve(const QwtText& title, const QPen& pen, ArraySeriesData* data)
{
	QwtPlotCurve* curve = new QwtPlotCurve(title);
	curve->setStyle(QwtPlotCurve::Lines);
	curve->setPen(pen);

	curve->setRenderHint(QwtPlotItem::RenderAntialiased, false);
	curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true);

	curve->setData(data);
	curve->attach(m_plot);

	return curve;
}
开发者ID:CBRUhelsinki,项目名称:CENTplatform,代码行数:14,代码来源:PowerBarHistoryPlot.cpp

示例9: drawGauss

void Plot::drawGauss(double m, double a, int type, int i)
{
    // Insert new curves
    int j;
    QwtPlotCurve *curve = new QwtPlotCurve(QString("m: %1; a: %2").arg(m).arg(a));
    if (type == 0){
        curve->setData(new GaussData(m, a));
    }else if (type == 1){
        curve->setData(new ExpData(m, a));
    }else{
        curve->setData(new ExpData(m, -a));
    }


    switch (i % 5) {
    case 0:
        curve->setPen(Qt::red);
        break;
    case 1:
        curve->setPen(Qt::green);
        break;
    case 2:
        curve->setPen(Qt::blue);
        break;
    case 3:
        curve->setPen(Qt::magenta);
        break;
    case 4:
        curve->setPen(Qt::cyan);
        break;
    default:
        break;
    }
    curve->attach(this);

    this->replot();
}
开发者ID:kmi9work,项目名称:Fires,代码行数:37,代码来源:plot.cpp

示例10: tr

	EventLogger(const char* target, int eventId, int eventVariablesCount, const char* filename) :
		QwtPlot(QwtText(QString(tr("Plot for event %0")).arg(eventId))),
		eventId(eventId),
		values(eventVariablesCount)
	{
		stream = Hub::connect(target);
		cout << "Connected to " << stream->getTargetName() << endl;

		startingTime = QTime::currentTime();

		setCanvasBackground(Qt::white);
		setAxisTitle(xBottom, tr("Time (seconds)"));
		setAxisTitle(yLeft, tr("Values"));

		QwtLegend *legend = new QwtLegend;
		//legend->setItemMode(QwtLegend::CheckableItem);
		insertLegend(legend, QwtPlot::BottomLegend);

		for (size_t i = 0; i < values.size(); i++)
		{
			QwtPlotCurve *curve = new QwtPlotCurve(QString("%0").arg(i));
			#if QWT_VERSION >= 0x060000
			curve->setData(new EventDataWrapper(timeStamps, values[i]));
			#else
			curve->setData(EventDataWrapper(timeStamps, values[i]));
			#endif
			curve->attach(this);
			curve->setPen(QColor::fromHsv((i * 360) / values.size(), 255, 100));
		}

		resize(1000, 600);

		if (filename)
			outputFile.open(filename);

		startTimer(10);
	}
开发者ID:davidjsherman,项目名称:aseba,代码行数:37,代码来源:eventlogger.cpp

示例11: addSampleSource

            void AmplitudePlot::addSampleSource(PointSampler* src) {
                
                // Insert new curves
                QwtPlotCurve* curve = new QwtPlotCurve(src->objectName());
                _sources.insert(src, curve);
                curve->setPen(QPen(src->getColor()));
                curve->setRenderHint(QwtPlotItem::RenderAntialiased);
                
                SampleHistoryPlotDataAdapter adapter(src);
                curve->setData(adapter);
                
                curve->attach(_ui->plot);
                
                _ui->plot->setAxisScale(QwtPlot::xBottom, 0, src->getHistory().size());

                connect(src, SIGNAL(sampleHistoryChanged(const PointSampler*)), SLOT(updatePlot()));
                connect(src, SIGNAL(enabledChanged(bool)), SLOT(updateSeriesVisibility(bool)));
            }
开发者ID:metasim,项目名称:ews,代码行数:18,代码来源:AmplitudePlot.cpp

示例12: 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);
}
开发者ID:amesser,项目名称:mmgui,代码行数:18,代码来源:mainwindow.cpp

示例13: createPowerCurve

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StatsGenPlotWidget::createPowerCurve(int tableRow, float& xMax, float& yMax)
{
  QwtPlotCurve* curve = m_PlotCurves[tableRow];
  int err = 0;
  float alpha = m_TableModel->getDataValue(SGPowerLawTableModel::Alpha, tableRow);
  float k = m_TableModel->getDataValue(SGPowerLawTableModel::K, tableRow);
  float beta = m_TableModel->getDataValue(SGPowerLawTableModel::Beta, tableRow);
  int size = 256;
  QwtArray<float> x;
  QwtArray<float> y;

  err = StatsGen::GenPowerLawPlotData<QwtArray<float > > (alpha, k, beta, x, y, size);
  if (err == 1)
  {
    //TODO: Present Error Message
    return;
  }

  QwtArray<double> xD(size);
  QwtArray<double> yD(size);
  for (int i = 0; i < size; ++i)
  {
    //   qDebug() << x[i] << "  " << y[i] << "\n";
    if (x[i] > xMax)
    {
      xMax = x[i];
    }
    if (y[i] > yMax)
    {
      yMax = y[i];
    }
    xD[i] = static_cast<double>(x[i]);
    yD[i] = static_cast<double>(y[i]);
  }
#if QWT_VERSION >= 0x060000
  curve->setSamples(xD, yD);
#else
  curve->setData(xD, yD);
#endif

  m_PlotView->setAxisScale(QwtPlot::yLeft, 0.0, yMax);
  m_PlotView->setAxisScale(QwtPlot::xBottom, 0.0, xMax);
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:46,代码来源:StatsGenPlotWidget.cpp

示例14: AddCurve

void CBioPlot::AddCurve( int pen_width )
{
	boost::mutex::scoped_lock lock(data_lock);

	// sanity check
	if ( thePlot == NULL )
	{
		cerr << "Woops, no plot!" << endl;
		throw;
	}

	// don't add more crves if we are at the max
	if ( NumCurves() >= BIOPLOT_MAX_CURVES ) return;

	size_t curve_num = NumCurves();

	// create a new curve for this data set
	QwtPlotCurve * curve = new QwtPlotCurve();
	theCurves.push_back( curve );

	// add the curve to the plot
	curve->attach(thePlot);

	// set the color of the curve
	QPen * pen = new QPen;
	thePens.push_back( pen );

	pen->setColor( QColor( curve_colors[curve_num] ) );
	pen->setWidth( pen_width );

	/* set pen to curve */
	curve->setPen( *pen );

	// add a data set for this curve and bind it to the curve
	theDataX.push_back( data_t() );
	theDataY.push_back( data_t() );
	curve->setData( theDataX[curve_num], theDataY[curve_num] );

	// change style or quality of the curve
	//curve->setStyle( QwtPlotCurve::Dots );
	//curve->setRenderHint(QwtPlotItem::RenderAntialiased);

}
开发者ID:qualified-self,项目名称:nexus-10,代码行数:43,代码来源:CBioPlot.cpp

示例15: updateRDFPlot

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StatsGenRDFWidget::updateRDFPlot(QVector<float>& freqs)
{
  // These are the output vectors
  QwtArray<double> xD(static_cast<int>(freqs.size()));
  QwtArray<double> yD(static_cast<int>(freqs.size()));

  QLocale loc = QLocale::system();

  bool ok = false;
  float minDist = loc.toFloat(minDistLE->text(), &ok);
  float maxDist = loc.toFloat(maxDistLE->text(), &ok);

  const int numValues = freqs.size();
  float increment = (maxDist - minDist) / numValues;

  double pos = minDist;

  for (qint32 i = 0; i < numValues; ++i)
  {
    xD[i] = pos;
    yD[i] = static_cast<double>(freqs.at(i));
    pos = pos + increment;
  }

  // This will actually plot the XY data in the Qwt plot widget
  QwtPlotCurve* curve = m_PlotCurve;
#if QWT_VERSION >= 0x060000
  curve->setSamples(xD, yD);
#else
  curve->setData(xD, yD);
#endif
  curve->setStyle(QwtPlotCurve::Lines);
  //Use Antialiasing to improve plot render quality
  curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
  QPen pen;
  pen.setColor(Qt::white);
  pen.setWidth(2);
  curve->setPen(pen);//Set colour and thickness for drawing the curve
  curve->attach(m_RDFPlot);
  m_RDFPlot->replot();
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:44,代码来源:StatsGenRDFWidget.cpp


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