setRangeDragAxes(),感觉可以用,但是没实现出来,各位大神有没有想法,最好给出大致代码,谢谢
void MainWindow::setupSimpleDemo(QCustomPlot *customPlot)
{
demoName = "Simple Demo";
// add two new graphs and set their look:
customPlot->addGraph();
customPlot->graph(0)->setPen(QPen(Qt::blue)); // line color blue for first graph
customPlot->addGraph();
customPlot->graph(1)->setPen(QPen(Qt::red)); // line color red for second graph
// generate some points of data (y0 for first, y1 for second graph):
QVector<double> x(250), y0(250), y1(250);
for (int i=0; i<250; ++i)
{
x[i] = i;
y0[i] = qExp(-i/150.0)*qCos(i/10.0); // exponentially decaying cosine
y1[i] = qExp(-i/150.0); // exponential envelope
}
customPlot->graph(0)->setData(x, y0);
customPlot->graph(1)->setData(x, y1);
// let the ranges scale themselves so graph 0 fits perfectly in the visible area:
customPlot->graph(0)->rescaleAxes();
// same thing for graph 1, but only enlarge ranges (in case graph 1 is smaller than graph 0):
customPlot->graph(1)->rescaleAxes(true);
// Note: we could have also just called customPlot->rescaleAxes(); instead
// Allow user to drag axis ranges with mouse, zoom with mouse wheel and select graphs by clicking:
customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
// QPointer<QCPAxis> mColorAxis;
// mColorAxis.data()
// customPlot->axisRect()->setRangeDragAxes(customPlot->axisRect()->axis(QCPAxis::atBottom),customPlot->axisRect()->axis(QCPAxis::atLeft));
}
7 个解决方案
#1
自己帮顶下,求大神指导,谢谢
#3
要能找到的话,我已经找到了,网上好像没有,能给点具体的代码吗??
#4
换*google再试试。
#5
没有人用过qcustomPlot第三方库区写过曲线的吗??
#6
用过
#7
楼主,你解决了吗,我也遇到了这个问题,求指点
#1
自己帮顶下,求大神指导,谢谢
#2
#3
要能找到的话,我已经找到了,网上好像没有,能给点具体的代码吗??
#4
换*google再试试。
#5
没有人用过qcustomPlot第三方库区写过曲线的吗??
#6
用过
#7
楼主,你解决了吗,我也遇到了这个问题,求指点