QWT plot with autoscaling shows negative values in y-axis
Hi,
I have a QWT plot which shows only positive data values as a curve. I want autoscaling to be done since the values are not fixed in a range. But when autoscaling is enabled for y-left axis, then y-axis starts with negative values. how can i avoid this?
setAxisAutoScale(QwtPlot::yLeft,true);
I tried changing void QwtPlot::updateAxes() in my own class but facing issues because of d_axisData[axisId] private data.
Thanks
Re: QWT plot with autoscaling shows negative values in y-axis
Autoscaling means, that you want to calculate the scales from a given interval ( the bounding interval of all plot items having the QwtPlotItem::AutoScale flag enabled ). The algorithm for this calculation is implemented in the scale engine - usually QwtLinearScaleEngine::autoScale().
If you are not happy with the result of the algorithm you have 2 options:
- overload QwtLinearScaleEngine::autoScale
- not using autoscaling and doing setAxisScale instead
The code you would have to write is more or less the same.
Uwe