查看完整版本: [-- QcustomPlot --]

QTCN开发网 -> Qt基础编程 -> QcustomPlot [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

xuyue0401 2014-08-21 14:49

QcustomPlot

大家好,我使用QcustomPlot画图
程序都是例子上的,但是运行的图就是不对,为啥呢,请高手帮忙。
QVector<double> x(101), y(101); // initialize with entries 0..100    for (int i=0; i<101;++i)    {      x = i/50.0 - 1; // x goes from -1 to 1      y = x*x;  // let's plot a quadratic function    }    // create graph and assign data to it:    customPlot->addGraph();    //customPlot->graph(0)->setData(x, y);    // give the axes some labels:    customPlot->xAxis->setLabel("X");    customPlot->yAxis->setLabel("Y");    // set axes ranges, so we see all data:   customPlot->xAxis->setRange(-1, 1);   customPlot->yAxis->setRange(0, 1);
   ui->customPlot->replot();
[attachment=12505]

kimtaikee 2014-08-21 16:53
你的那个xAxis和yAxis的setRange的range不对!

xuyue0401 2014-08-21 20:12
例子就是这么设定的,应该没有错

xuyue0401 2014-08-22 09:35
已经解决,谢谢

gfanny 2017-05-18 18:08
    


查看完整版本: [-- QcustomPlot --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled