Results 1 to 2 of 2

Thread: Controlling order of plot items in Qwt 6.1 Legend

  1. #1
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Controlling order of plot items in Qwt 6.1 Legend

    We have both Markers (QwtPlotMarkers) and Curves (QwtPlotCurves) shown in a QwtPlot's legend. See this screenshot:

    MarkersAndCurvesInLegend.png

    We would like all Markers to come after all Curves in the legend.

    With Qwt 5.2.3, we used to be able to achieve that (Markers coming after Curves) by first turning off, and then turning on again, legend visibility for Markers, like this (mixed pseudo-code):

    Qt Code:
    1. For all Markers:
    2. marker->setItemAttribute (QwtPlotItem::Legend, false);
    3.  
    4. For all Markers:
    5. marker->setItemAttribute (QwtPlotItem::Legend, true);
    To copy to clipboard, switch view to plain text mode 
    That doesn't have any apparent effect in Qwt 6.1.2. (I tried also doing this instead for the Curves, in case this algorithm was putting the effected QwtPlotItems FIRST instead of LAST in the legend item order. That also had no effect).

    In Qwt 6.1, is there a way to control the order of legend items?
    Thank you in advance.

  2. #2
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Controlling order of plot items in Qwt 6.1 Legend

    UPDATE ... I did get this to work. The algorithm of "removing" all Markers, and then "re-adding" them works with Qwt 6.1 if you detach/re-attach them, rather than just enabling/disabling their legend-inclusion. That is ...

    Qwt 5.2.3 technique:
    marker->setItemAttribute (QwtPlotItem::Legend, false);
    marker->setItemAttribute (QwtPlotItem::Legend, true);

    Qwt 6.1.2 technique:
    marker->detach();
    marker->attach (this);

Similar Threads

  1. PRint plot with Legend
    By OverTheOCean in forum Qwt
    Replies: 1
    Last Post: 27th July 2011, 09:09
  2. Printing plot with many legend items
    By coppermine in forum Qwt
    Replies: 1
    Last Post: 11th March 2011, 11:18
  3. Controlling Property Setting Order
    By thePoet in forum Qt Tools
    Replies: 1
    Last Post: 13th July 2010, 20:29
  4. Replies: 7
    Last Post: 18th September 2009, 11:59
  5. legend inside qwt plot
    By kaustav98255 in forum Qwt
    Replies: 5
    Last Post: 11th February 2009, 21:39

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.