菜鸟求助qwtplot画图问题
用qwtplot画很简单的图试验下,总是出现这种情况: 画到最后一个点时出现一条回原点的直线。请问这是什么原因造成的。。上图是画了一条y=200-x 的直线。代码如下。 for (int i = 0; i< PLOT_SIZE - 1; i++) { d_x = i; // time axis d_y = 200 - i; } ui->myPlot->setAxisScale(QwtPlot::xBottom, 0, 250); ui->myPlot->setAxisScale(QwtPlot::yLeft,-50,200); QwtPlotCurve curve("y=200-x"); curve.attach(ui->myPlot);//把曲线附加到plot上 curve.setData(d_x,d_y,PLOT_SIZE);//设置数据 curve.setStyle(QwtPlotCurve::Lines);//直线形式// curve.setCurveAttribute(QwtPlotCurve::Fitted, true);//使曲线更光滑 curve.setPen(QPen(Qt::blue));//设置画笔 ui->myPlot->replot();