PDA

View Full Version : Min Max Values of all Curves



HappyCoder
5th August 2015, 12:41
Hi,

i calculate the max, min values over all attached curves of a plot



QwtPlotItemList curveList = plot()->itemList( QwtPlotItem::Rtti_PlotCurve );

for ( int i = 0; i < curveList.size(); i++ )
{
QwtPlotCurve *curve = static_cast<QwtPlotCurve *>( curveList[i] );

d_data->maxLimitX = qMax( d_data->maxLimitX, curve->maxXValue() );
d_data->minLimitX = qMin( d_data->minLimitX, curve->minXValue() );

d_data->maxLimitY = qMax( d_data->maxLimitY, curve->maxYValue() );
d_data->minLimitY = qMin( d_data->minLimitY, curve->minYValue() );
}


Does QwtPlot provide an integrated function to get the same? I didn't found any.

Thx
Stefan

Uwe
5th August 2015, 18:09
Better move your code into YourCurve::boundingRect() or even better: QwtSeriesData<QPointF>::boundingRect().

The bounding rectangle is useful for certain operations ( f.e auto scaling ) and when it is possible to calculate it without having to iterate over all points you can speed up those operations.

Uwe