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


C++ Plotter::setPlotSettings方法代码示例

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


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

示例1: slot_do_boxing

void CMenuRecord::slot_do_boxing()
{
   // CDlgRecordWave *dlg = new CDlgRecordWave(this);

    Plotter *plotter = new Plotter(this);

    int numPoints = 100;
    QVector<QPointF> points0;
    QVector<QPointF> points1;
    for (int x = 0; x < numPoints; ++x) {
        points0.append(QPointF(x, uint(qrand()) % 100));
        points1.append(QPointF(x, uint(qrand()) % 100));
    }
    plotter->setCurveData(0, points0);
    plotter->setCurveData(1, points1);

    PlotSettings settings;
    settings.minX = 0.0;
    settings.maxX = 100.0;
    settings.minY = 0.0;
    settings.maxY = 100.0;
    plotter->setPlotSettings(settings);

   plotter->show();
}
开发者ID:zyzzyva8421,项目名称:monitor,代码行数:25,代码来源:menu_record.cpp

示例2: main

int main(int argc, char *argv[])
{

/************************************************* example as a standalone window ************************************************************/
/*	
	//create an application
	QApplication app(argc, argv);					
   
	// create and fill the data vector
	QVector<QPointF> data1;
	for (float i=0;i<20;i+=0.1)
		data1.append(QPointF(i,sin(i)));

	// create and fill another data vector
	QVector<QPointF> data2;
	for (float i=0;i<20;i+=0.1)
		data2.append(QPointF(i,sin(i/2)));

	//creat the plotter and set its data
	Plotter *plotter = new Plotter;							// create a plotter
	plotter->setPlotSettings(PlotSettings(0,20,-2,2));		//initialise the axis
	plotter->setCurveData(0,data1);							//set the first plotter data set
	plotter->setCurveData(1,data2);							//set the second plotter data set
	
	//show the plotter widget
	plotter->show();										
    
	//execute the application
	return app.exec();						
*/
/*********************************************************************************************************************************************/


/******************************************** example of use as a widget among others *********************************************************/
	
	//create an application
	QApplication app(argc, argv);				

	// create a window
    QWidget *window = new QWidget;
	window->setWindowTitle("Plotter widget application");

	// create a label
	QLabel *label = new QLabel("<h2><i><font color=blue> Plot example </font> </i></h2>");
	
	//create the plotter and its data
	Plotter *plotter = new Plotter;	
	plotter->setPlotSettings(PlotSettings(0,20,-2,2));		
	
	QVector<QPointF> data1;
	for (float i=0;i<20;i+=0.1)
		data1.append(QPointF(i,sin(i)));
	QVector<QPointF> data2;
	for (float i=0;i<20;i+=0.1)
		data2.append(QPointF(i,sin(i/2)));
	
	plotter->setCurveData(0,data1);							
	plotter->setCurveData(1,data2);							
	

	//layout the widgets
	QVBoxLayout *layout = new QVBoxLayout;
	layout -> addWidget (label);
	layout -> addWidget (plotter);
	window->setLayout(layout);
	
	//show the window
	window->show();

	//execute the application
	return app.exec();	
	
/*********************************************************************************************************************************************/


}
开发者ID:pyrech,项目名称:telemetre,代码行数:76,代码来源:main.cpp


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