PDA

View Full Version : align QwtLegendItems to their curves



cradle
9th November 2011, 11:55
Hey hey,

allright...i have a QwtPlot and a QwtLegend and QwtPlotCurves attached to it. The titles of the curves can be seen in the QwtLegend (attached screenshot - how it is)
Now my question is: is it possible to order the legend items in a way, that every curve has its name straight beside itself? (attached screenshot - how it should be)

Thx so far!
cradle

Uwe
9th November 2011, 13:58
As all curves have the same line/symbol settings I wouldn't use a legend and do it with tick labels instead.


assign a QwtScaleDiv ( QwtPlot::setAxisScaleDiv() ) with major ticks at the y values that correspond to your curves.
Derive from QwtScaleDraw, disable everything beside the tick labels and reimplement YourScaleDraw::label()

HTH,
Uwe

cradle
9th November 2011, 18:16
Hey Uwe,

Thanks for the tip. That does the trick! :)