class YourChart: public QwtPlotMultiBarChart
{
const QRectF &canvasRect
) const {
m_barGeometries.clear();
QwtPlotMultiBarChart::draw( painter, xMap, yMap, canvasRect );
}
virtual void drawBar
( QPainter *painter,
int sampleIndex, int valueIndex, const QwtColumnRect &rect ) const
{
m_barGeometries.store( sampleIndex, valueIndex, rect );
QwtPlotMultiBarChart::drawBar( painter, sampleIndex, valueIndex, rect );
}
{
// find sampleIndex/valueIndex from m_barGeometries
// and return the title using barTitles()
...
}
private:
LookUpTable m_barGeometries;
};
class YourChart: public QwtPlotMultiBarChart
{
virtual void draw( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect ) const
{
m_barGeometries.clear();
QwtPlotMultiBarChart::draw( painter, xMap, yMap, canvasRect );
}
virtual void drawBar( QPainter *painter,
int sampleIndex, int valueIndex, const QwtColumnRect &rect ) const
{
m_barGeometries.store( sampleIndex, valueIndex, rect );
QwtPlotMultiBarChart::drawBar( painter, sampleIndex, valueIndex, rect );
}
QwtText barTitleAt( QPoint &pos ) const
{
// find sampleIndex/valueIndex from m_barGeometries
// and return the title using barTitles()
...
}
private:
LookUpTable m_barGeometries;
};
To copy to clipboard, switch view to plain text mode
Bookmarks