PDA

View Full Version : How to display external legends in Qwt?



saliemam
7th December 2010, 04:30
Hi everyone,

I'm trying to create a plot with an external legends. I looked forward some simple instructions which show me the way.

I know that after configuring the legends, I have to use this instruction:


insertLegend(d_legend, QwtPlot::ExternalLegend);

but I couldn't find a way to show them say in layout. Usually people say use printlegend (or something) to do that. I tried but it was unsuccessful

Would you please send me a simple piece of code which shows how to do that?
Consider that my plot name is Plot and put the legend in a layout named HLayout.

Thanks

Uwe
7th December 2010, 06:39
QwtLegend is a widget like any other widget and an external legend can be put into any Qt Layout. This is too trivial for posting code !

Only when you want to print or export your plot together with an external legend to a document you have to calculate the target rectangles for plot and legend on your own. Then use QwtPlot::print + QwtPlot::printLegend.

Uwe

saliemam
7th December 2010, 22:49
Uwe,

Thank you for the response,

I'd seen the solution before, but my problem is the is no print or printLegend member in the QwtPlot class (or I am more than beginner that I can not find them:( ). That's why I reqested a peice of code.

Uwe
8th December 2010, 05:53
Then you are using Qwt 6.x and have to check QwtPlotRenderer.

Uwe