Re: Draw text on top of both canvas and plot background?
Brought to you by:
rathmann
|
From: Elvis S. <elv...@or...> - 2019-03-12 08:19:54
|
Den tis 12 mars 2019 kl 09:09 skrev Uwe Rathmann <Uwe...@ti...>:
>
> Hi Elvis,
>
> > Hope that makes it more clear.
>
> That doesn't answer my question, but maybe all you want to do is:
>
> class YourScaleDraw : public QwtScaleDraw
> {
> ....
>
> QwtText label( double value ) const override
> {
> auto txt = QLocale().toString( value );
>
> const auto ticks = scaleDiv().ticks[ QwtScaleDiv::MajorTick ];
> if ( !ticks.empty() && value == ticks.last() )
> {
> txt += "\nUnit";
I completely missed the (very crucial) "\n" here Uwe! I will try that.
It will add to the total height of the top axis, which is what I was
hoping to avoid, but may be good enough. Thanks!
In my use case, horizontal space is at a premium (many side-by-side
plots), but I do have vertical space to spare.
Elvis
> }
>
> return txt;
> }
> };
>
> plot->setAxisScaleDraw( QwtPlot::xTop, new YourScaleDraw() );
>
> Uwe
|