Results 1 to 6 of 6

Thread: Multiple Legends

  1. #1

    Default Multiple Legends

    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?

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Multiple Legends

    See Cpuplot example

  3. #3

    Default Re: Multiple Legends

    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.

  4. #4

    Default Re: Multiple Legends

    I am using QwtLegend tempLegend to generate a legend and a QList<QWidget *> tempList to construct a list of legends.

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiple 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

  6. #6

    Default Re: Multiple Legends

    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.

Similar Threads

  1. Replies: 3
    Last Post: 7th July 2011, 07:03
  2. How to display external legends in Qwt?
    By saliemam in forum Qwt
    Replies: 3
    Last Post: 8th December 2010, 05:53
  3. How to display external legends in Qwt?
    By saliemam in forum Newbie
    Replies: 0
    Last Post: 1st December 2010, 03:33
  4. Qwt: How to create legends inside plots ?
    By Comer352l in forum Qwt
    Replies: 5
    Last Post: 16th August 2009, 18:02
  5. Replies: 4
    Last Post: 15th October 2008, 13:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.