本文整理汇总了C++中QCPGraph::setAdaptiveSampling方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPGraph::setAdaptiveSampling方法的具体用法?C++ QCPGraph::setAdaptiveSampling怎么用?C++ QCPGraph::setAdaptiveSampling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCPGraph
的用法示例。
在下文中一共展示了QCPGraph::setAdaptiveSampling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupAdaptiveSamplingTest
void MainWindow::setupAdaptiveSamplingTest(QCustomPlot *customPlot)
{
qsrand(1);
QCPGraph *g = customPlot->addGraph();
int n = 200000;
QVector<double> x, y;
x << -6;
y << 2;
for (int i=0; i<n/2; ++i)
{
x << i/(double)(n/2-1)*4-5;
if (qrand()%(n/25) == 0)
y << qrand()/(double)RAND_MAX*7; // generate outliers (must be preserved in adaptive-sampling-algorithm)
else
y << qCos(qrand()/(double)RAND_MAX*2*M_PI)*qSqrt(-2*qLn(qrand()/(double)RAND_MAX)) + 5*qSin(x[i]);
}
x << 0.5;
y << 2;
for (int i=0; i<n/2; ++i)
{
x << i/(double)(n/2-1)*4+1;
if (qrand()%(n/25) == 0)
y << qrand()/(double)RAND_MAX*7; // generate outliers (must be preserved in adaptive-sampling-algorithm)
else
y << qCos(qrand()/(double)RAND_MAX*2*M_PI)*qSqrt(-2*qLn(qrand()/(double)RAND_MAX)) + qSin(5*x[i]);
}
x << 6;
y << -1;
g->setData(x, y);
//g->setScatterStyle(QCPScatterStyle::ssPlus);
//g->setLineStyle(QCPGraph::lsNone);
g->setAdaptiveSampling(true);
customPlot->setPlottingHint(QCP::phFastPolylines, true);
customPlot->rescaleAxes();
customPlot->xAxis->scaleRange(1, customPlot->xAxis->range().center());
customPlot->yAxis->scaleRange(1, customPlot->yAxis->range().center());
}