1 Attachment(s)
How to draw rectangle over qwtPlotCurve?
Hi,
Is it possible to draw transparent colored resctangles over qwtPlotCurve(see attached example plot, red curve is the qwtPlotCurve) I'm thinking of drawing histogram and qwtPlotCurve on the same plot, but not sure if it is doable.
Anybody has a suggestion?
Thanks in advance!
Re: How to draw rectangle over qwtPlotCurve?
Quote:
Originally Posted by
qmonkey
I'm thinking of drawing histogram and qwtPlotCurve on the same plot, but not sure if it is doable
In general you can have as many plot items as you want on a plot, but I recommend to implement a new plot item instead of misusing a histogram:
Code:
{
public:
RangeMarker()
{
setZ( ... );
}
void setInterval( QwtInterval& interval )
{
m_interval = interval;
}
const QRectF &canvasRect
) const {
int x1 = qRound( xMap.transform( m_interval.minValue() ) );
int x2 = qRound( xMap.transform( m_interval.maxValue() );
painter
->fillRect
( QRect( x1, canvasRect.
top(), x2
- x1, canvasRect.
height() ), ...
);
}
};
HTH,
Uwe
Re: How to draw rectangle over qwtPlotCurve?
Uwe,
This is exactly what I needed. I appreciated your time for replying with the code!