首页| 论坛| 消息

回复: QCustomPlot画曲线
#6 [zxwmail 03-31 22:09]
贴一下你的x,y值看看
#7 回 zxwmail 的帖子 [赵小七 04-01 15:30]
QVector x(101),y(101);//分别存放x和y坐标的数据,101为数据长度for(int i=0;iqCustomPlot->addGraph();ui->qCustomPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); //添加数据 ui->qCustomPlot->graph(0)->setData(x,y);
//设置坐标轴标签名称 ui->qCustomPlot->xAxis->setLabel("x"); ui->qCustomPlot->yAxis->setLabel("y");
//设置坐标轴显示范围,否则我们只能 ..
#8 回 zxwmail 的帖子 [赵小七 04-01 15:42]
zxwmail:
贴一下你的x,y值看看
QVector x(101),y(101);//分别存放x和y坐标的数据,101为数据长度

for(int i=0;iqCustomPlot->addGraph();
ui->qCustomPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
//添加数据
ui->qCustomPlot->graph(0)->setData(x,y);

//设置坐标轴标签名称
ui->qCustomPlot->xAxis->setLabel("x");
ui->qCustomPlot->yAxis->setLabel("y");

//设置坐标轴显示范围,否则我们只能看到默认的范围
// ui->qCustomPlot->xAxis->setRange(0,11);
//ui->qCustomPlot->yAxis->setRange(0,110);
ui->qCustomPlot->rescaleAxes();
ui->qCustomPlot->rescaleAxes();

for循环从0开始,结果是

for循环从1开始,结果是

<< 1 2 >> (2/2)

回复 发表
主题 版块