本文整理汇总了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();
}
示例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();
/*********************************************************************************************************************************************/
}