Hi,
I'm having trouble understanding how to update my boundingRect() yMin and yMax values when the plot is zoomed using the QwtPlotZoomer. Ideally I'd like the YAxis to be autoscaled to the Zoom window.
My understanding is that I need to somehow update my boundingRect() in my overloaded QwtDataSeries object but I have not found a solution.
My YAxis values are always autoscaled to the min/max values of the entire data series as that's what is passed into the constructor
MyDataSeries::MyDataSeries(struct MyData_struct *myData, qint64 startTime, double maxY, double minY)
{
_myData = myData;
_startTime = startTime;
_maxY = maxY;
_minY = minY;
}
size_t SacDataSeries::size() const
{
return _myData->npts;
}
QPointF SacDataSeries
::sample( size_t i
) const {
return QPointF( _startTime
+ (i
* _myData
->delta
*1000), _myData
->data
[i
] );
}
QRectF SacDataSeries
::boundingRect() const {
return QRect( 0.0, _minY , size
() * (_myData
->delta
*1000), _maxY
- (_minY
) );
}
MyDataSeries::MyDataSeries(struct MyData_struct *myData, qint64 startTime, double maxY, double minY)
{
_myData = myData;
_startTime = startTime;
_maxY = maxY;
_minY = minY;
}
size_t SacDataSeries::size() const
{
return _myData->npts;
}
QPointF SacDataSeries::sample( size_t i ) const
{
return QPointF( _startTime + (i * _myData->delta*1000), _myData->data[i] );
}
QRectF SacDataSeries::boundingRect() const
{
return QRect( 0.0, _minY , size() * (_myData->delta*1000), _maxY - (_minY) );
}
To copy to clipboard, switch view to plain text mode
Bookmarks