PDA

View Full Version : Scaling Legends when exporting to pdf file



Buffy
26th April 2013, 11:16
Is there a way to scale the legend when exporting to a pdf file?

I’m trying to allow the user to scale the canvas during export but the legends always remain the same size when I do this. I am using Qt 4.8.4 and qwt 6.0.0-rc5. To scale the canvas I call QwtPlotRenderer::render. In an export preview window, the user can move one of two sliders that change the plot rectangle size that gets passed into renderer.

Ideally I would like to be able to size the legend independently of the canvas. Any hints about how to go about doing this? I like how the plot screen looks and works but just need to deal with more flexibility when exporting & printing. For the QwtPlot, I set the legend ratio when adding the legends to 0.8.

I’ve played around with calling QwtPlotLayout::setLegendRatio() before calling renderer but this had no effect. I also tried overriding QwtLegend::sizeHint() which did make the font smaller but still laid out the plot with the same amount of space reserved for the legend. This just resulted in more blank space.

Thanks in advance for any help.

Uwe
26th April 2013, 12:25
First of all I recommend to use Qwt 6.1. It has a completely new system for legends and maybe even more important: it allows to derive and assign a modified QwtPlotLayout, that is responsible for calculating the rectangles used inside the widget and by the QwtPlotRenderer.

Uwe

Radamel
26th April 2013, 17:22
В Индии взрывы у Тадж Махала, в Америке на марафоне гибнут люди. Жуть какая-то товрится. Что не так с этим миром? На прошлой неделе я писал об этом на своем <a href="http://snowysport.com/">блоге</a>. Заходите, подискутируе м, обсудим, поразмышляем .

Buffy
26th April 2013, 17:43
First of all I recommend to use Qwt 6.1. It has a completely new system for legends and maybe even more important: it allows to derive and assign a modified QwtPlotLayout, that is responsible for calculating the rectangles used inside the widget and by the QwtPlotRenderer.

Uwe

Thanks Uwe. I also checked out 6.1 and the legend example that comes along with it but I didn't think 6.1 was released yet. Is it still in Beta or is it released?

Uwe
26th April 2013, 17:54
The code is final ( at least what you find in SVN ) - the only reason that has not been released yet is that I had planned to work on the docs.
But I don't find any time at the moment ...

Uwe