Hi
I want to have two group of legends in the same graph. If I insert on the Left Yaxis I want the legend on the left side and if I insert on the right Yaxis I want the legend on the right side.
Any hints on how to do this?
Hi
I want to have two group of legends in the same graph. If I insert on the Left Yaxis I want the legend on the left side and if I insert on the right Yaxis I want the legend on the right side.
Any hints on how to do this?
See Cpuplot example
No that are axis labels and I want a grouping of legends.
Added after 20 minutes:
Plus I get an error legend() not defined in scope, whereas I have added all the headerfiles except qlayout.h which is not present. The Cpu example is just enabling and disabling curves, whereas I want to group existing curves so by looking a user can know which legend denotes a curve of which axis.
Last edited by Pandimensional; 28th June 2012 at 12:54.
I am using QwtLegend tempLegend to generate a legend and a QList<QWidget *> tempList to construct a list of legends.
Having more than one legend would be hard with Qwt <= 6.0 - probably not doable without having very deep insight into the implementation.
But in SVN trunk the legend system has been redesigned and you would need to connect some signals to your 2 legends only. The part that won't be trivial is how to make QwtPlotRenderer ( if you need it ) to be aware of your legends. See the stockchart example, that implements a legend as treeview.
Also note that you also have the option of using one ( or several ) QwtPlotLegendItem, displaying the legend on the canvas. See the legends example.
The state in trunk of the plot framework should be ~stable ( I only plan to add one plot item for Qwt 6.1 ), but all classes derived from QwtAbstractSlider ( the design is more than 10 years old and I hated it from the very beginning ) are under heavy modifications.
Uwe
Thanks a lot Uwe it was a very useful tip to update the SVN trunck.
The problem was finally solved by editing and filtering the legendItems and attach the filtered legendItems to their respective axis. The legends example was very handy, the legendtree in the stockchart example was a good learning experience but was not taken forward because it seemed a bit complex.
Bookmarks