I have drawn a curve and I want to get the y-value on the curve corresponding to a given x-value.
I am using a QwtPlot and QwtPlotCurve.
QwtPlotCurve no longer supports
"double y (int i) const ".
Am I correct in thinking that this functionality has been replaced by
"T QwtPlotSeriesItem< T >::sample ( int index ) const" ?
When I try to use this "sample" utility, I get a "Runtime Error" :-
int currentPosX = pos.x();
QPointF d = curve1->sample(currentPosX);
qreal value = d.y();
I have assumed that "sample" returns QPointF because that's the error message I get when I tried it with a double.
Is this the best way to get the curve value?
Why do I get the runtime error?
Any help you can provide will be much appreciated, thanks.
Bookmarks