Then better implement your own type of plot item.
Derive from QwtPlotSeriesItem and use samples like this:
class YourSample
{
public:
YourSample();
YourSample( const QwtInterval &, const QwtInterval & );
bool operator==( const YourSample & ) const;
bool operator!=( const YourSample & ) const;
//! Interval
QwtInterval interval[2];
};
class YourSample
{
public:
YourSample();
YourSample( const QwtInterval &, const QwtInterval & );
bool operator==( const YourSample & ) const;
bool operator!=( const YourSample & ) const;
//! Interval
QwtInterval interval[2];
};
To copy to clipboard, switch view to plain text mode
Then your series data object can return [ index - 0.5 , index + 0.5 [ as one interval and the other interval from your array.
class YourSeriesData: public QwtSeriesData<YourSample>
{
public:
YourSeriesData( const QVector<QwtInterval> &intervals):
m_intervals( intervals )
{
}
virtual size_t size() const
{
return m_intervals.size();
}
virtual YourSample sample( size_t i ) const
{
QwtInterval interval( i - 0.5, i + 0.5, QwtInterval:: ExcludeMaximum);
return YourSample( interval, m_intervals[i] );
}
virtual QRectF boundingRect
() const {
double xMin = -0.5;
double xMax = size() + 0.5;
double yMin = ...;
double yMax = ...;
return QRectF( xMin , yMin, xMax
- xMin, yMax
- yMin
);
}
};
class YourSeriesData: public QwtSeriesData<YourSample>
{
public:
YourSeriesData( const QVector<QwtInterval> &intervals):
m_intervals( intervals )
{
}
virtual size_t size() const
{
return m_intervals.size();
}
virtual YourSample sample( size_t i ) const
{
QwtInterval interval( i - 0.5, i + 0.5, QwtInterval:: ExcludeMaximum);
return YourSample( interval, m_intervals[i] );
}
virtual QRectF boundingRect() const
{
double xMin = -0.5;
double xMax = size() + 0.5;
double yMin = ...;
double yMax = ...;
return QRectF( xMin , yMin, xMax - xMin, yMax - yMin );
}
};
To copy to clipboard, switch view to plain text mode
Of course the code above is for vertical bars ( v.v. to your screenshot ).
Implementing the virtual methods for your plot item should be straight forward ( or copy and adopt your code from QwtPlotHistogram ).
Uwe
Bookmarks