Originally Posted by
Krippy
Is there a method of partially raising a marker, so that it can reveal a marker beneath it?
If you want to modify the position of the marker text in widget coordinates:
{
virtual void drawLabel
( QPainter *painter,
{
const QPointF &translatedPos
= ...;
};
class YourMarker: public QwtPlotMarker
{
virtual void drawLabel( QPainter *painter,
const QRectF &canvasRect, const QPointF &pos ) const
{
const QPointF &translatedPos = ...;
QwtPlotMarker::drawLabel( painter, canvasRect, translatedPos );
};
To copy to clipboard, switch view to plain text mode
Secondly, I have a set of symbols to denote different phases on the plot. I would like to include them in the legend even when they are absent from the graph.
legend and plot are synchronized by QwtPlot::legendDataChanged() and QwtAbstractLegend::updateLegend(). The second is virtual and would be a candidate for appending extra entries.
But there is also nothing wrong with inserting a dummy item. But if you don't want to insert real markers you can create a dummy QwtPlotItem, where you set the QwtPlotItem::Legend flag and overload QwtPlotItem::legendData(). Note that an item can have more than one entry ( f.e QwtPlotMultiBarChart ).
Uwe
Bookmarks