Two essential problems are being faced here: one is how to add two QwtPlotLegendItem, one at the side of the other and in the same corner of the graph
Overload QwtPlotLegendItem::geometry() and return what you need.
The second problem is how to do such a division in the plots.
virtual void YourLegendItem
::updateLegend( const QwtPlotItem *plotItem,
const QList<QwtLegendData> &data )
{
if ( plotItem->rtti() == ... )
return;
QwtPlotLegendItem::updateLegend( plotItem, data );
}
virtual void YourLegendItem::updateLegend( const QwtPlotItem *plotItem,
const QList<QwtLegendData> &data )
{
if ( plotItem->rtti() == ... )
return;
QwtPlotLegendItem::updateLegend( plotItem, data );
}
To copy to clipboard, switch view to plain text mode
And how could I create and configure the symbol legend?
The plot items are responsible for the information, that is displayed on the legend. Usually it is the title of the item and the icon, that is returned from QwtPlotItem::legendIcon(). But it is also possible to return more information - what is f.e. used by QwtPlotMultiBarChart.
All relevant plot items should offer an implementation of QwtPlotItem::legendIcon(), but the default setting of the QwtPlotItem::Legend flag depends on the type of plot item. For curves it is on, while f.e. for markers you would have to enable it to see them on the legend.
marker->setItemAttribute( QwtPlotItem::Legend, true );
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks