Re: AutoScaling not working
Quote:
Originally Posted by
Momergil
I noticed that auto scalling works by calculating the boundary rectangle of the QwtPlotCurve's data.
Yes and the bounding rectangle is cached. So you can't change your arrays behind the back of the curve.
In case of incremental data it doesn't make much sense to iterate over all points to recalculate the bound rectangle for each new sample. instead I would overload QwtPlotCurve::boundingRect() and do it in a more efficient way.
Uwe
Re: AutoScaling not working
Hello Uwe and thanks for the reply.
Quote:
Originally Posted by
Uwe
Yes and the bounding rectangle is cached. So you can't change your arrays behind the back of the curve.
I'm not sure I understood your explanation, but if that essentially means that I'll not be able to use auto replot for my situation, ok.
Quote:
Originally Posted by
Uwe
In case of incremental data it doesn't make much sense to iterate over all points to recalculate the bound rectangle for each new sample. instead I would overload QwtPlotCurve::boundingRect() and do it in a more efficient way.
I agree; too much processing consumption, specially for a embedded situation. The problem, though, is how exactly should I overload QwtPlotCurve::boundingRect()? I'm not familiar with doing this and all Qwt examples only give an ideia of doing it with the QwtPlotSeriesData or similar, not QwtPlotCurve's boundingRect() method.
Thanks,
Momergil
Re: AutoScaling not working
Quote:
Originally Posted by
Momergil
I'm not sure I understood your explanation, but if that essentially means that I'll not be able to use auto replot for my situation, ok.
No it only means, that the cached rectangle is not recalculated, when the curve is not aware of the fact, that the data has changed. But this is not important, when you reimplement QwtPlotCurve::boundingRect() like proposed.
Quote:
Originally Posted by
Momergil
The problem, though, is how exactly should I overload QwtPlotCurve::boundingRect()?
Well overloading is a very fundamental mechanism of OO languages like C++. You can read about it in the C++ book on your shelf.
Uwe
Re: AutoScaling not working
Quote:
Originally Posted by
Uwe
But this is not important, when you reimplement QwtPlotCurve::boundingRect() like proposed.
Ok - and thanks for the explanation.
Quote:
Originally Posted by
Uwe
when the curve is not aware of the fact, that the data has changed
Just for curiosity, then, how would I do this? (makes the curve aware of the fact that data has changed)
Quote:
Originally Posted by
Uwe
Well overloading is a very fundamental mechanism of OO languages like C++. You can read about it in the C++ book on your shelf.
Well Uwe, certanly I know what is to overload a method! xD I didn't mean that when I put my question, but instead: what exactly should I put inside the overloaded method? But I confess, reading it now, that my question wasn't clear at this point; sorry! :)
Re: AutoScaling not working
Quote:
Just for curiosity, then, how would I do this? (makes the curve aware of the fact that data has changed)
setRawSamples/setSamples are simply convenience methods creating a data object calling setData then. Behind the back means that you modify the samples inside of this data object without telling the curve with another call of setData.
Quote:
what exactly should I put inside the overloaded method?
How should I know - it depends on the details of your application.
f.e. if your x values are ordered in time you know the the x value of the first one is the minimum and the last one the maximum. If you add a new sample to an existing set, where you already know the bounding rectangle, all you need to do is to extend it by the coordinates of the new sample. Using such extra information makes it easy to find an implementation, that is way more efficient than the default implementation, that iterates over all points.
Uwe