• 5520阅读
  • 4回复

[原创]QcustomPlot [复制链接]

上一主题 下一主题
离线xuyue0401
 

只看楼主 倒序阅读 楼主  发表于: 2014-08-21
大家好,我使用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();

离线kimtaikee

只看该作者 1楼 发表于: 2014-08-21
你的那个xAxis和yAxis的setRange的range不对!

离线xuyue0401

只看该作者 2楼 发表于: 2014-08-21
例子就是这么设定的,应该没有错
离线xuyue0401

只看该作者 3楼 发表于: 2014-08-22
已经解决,谢谢
离线gfanny

只看该作者 4楼 发表于: 2017-05-18
    
快速回复
限100 字节
 
上一个 下一个