I'm trying to plot some data using qt 4.8 and qwt 6, but my curves doesn't scales over plot (1).
This is how I attach curves to plot:
curves[moduleIndex][channelIndex]->setSamples(samples, data);
curves[moduleIndex][channelIndex]->attach(plots[moduleIndex][channelIndex]);
samples and data is QVectors and samples.size() is equal to data.size()
plots[moduleIndex][channelIndex]->axisAutoScale(QwtPlot::xBottom)
returns true, so autoScale
is enabled.
So am I missing something?
UPDATE: I thought that the problem occures because disabled axis
plots[i][j]->enableAxis(QwtPlot::yLeft, false);
plots[i][j]->enableAxis(QwtPlot::xBottom, false);
But I've commented it out and it didn't help.
I believe 'autoscale' is alreadyworking. But to make axis look nice, it takes a rounded number for maximum which is causing a gap at the end. Scales of QwtPlot are managed by QwtScaleEngine. You can get a pointer to default scaleEngine your plot using with QwtPlot::axisScaleEngine(...). Setting Floating
attribute to true
will remove this gap and will fit your data to boundaries. See docs: http://qwt.sourceforge.net/class_qwt_scale_engine.html
Ex:
plot.axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating,true);