Results 1 to 5 of 5

Thread: How to use QwtLegend?

  1. #1
    Join Date
    Nov 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to use QwtLegend?

    The documentation around Qwt widgets isn't great, and can't find any simple examples on how to get started with QwtLegend. I'd like a simple legend on the right or bottom of a my bar chart representing that red bars are 'negative change' and blue bars are 'positive'. Could anyone provide an example? Any help or direction would be much appreciated.

  2. #2
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to use QwtLegend?

    Qwt has it's own examples in subdir of your source code:
    .\examples
    .\playground

    In subdir examples you will find the example "legends".

    If you want to have a legend inside your canvas use QwtPlotLegendItem

  3. #3
    Join Date
    Nov 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to use QwtLegend?

    Quote Originally Posted by HappyCoder View Post
    Qwt has it's own examples in subdir of your source code:
    .\examples
    .\playground

    In subdir examples you will find the example "legends".

    If you want to have a legend inside your canvas use QwtPlotLegendItem
    The examples don't do anything I want - they all demonstrate how to plot legends for each curve. I'd like to just create a custom legend from scratch

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

    Default Re: How to use QwtLegend?

    Quote Originally Posted by ashley1 View Post
    The examples don't do anything I want - they all demonstrate how to plot legends for each curve. I'd like to just create a custom legend from scratch
    When your legend is completely unrelated to the plot items you can simply use QLabels and arrange plot and labels in some QLayout.

    Otherwise you would need to provide more details: how many bar items do you have and which attributes of them do you want to display how on your legend.

    Uwe

  5. #5
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to use QwtLegend?

    Quote Originally Posted by ashley1 View Post
    [...] that red bars are 'negative change' and blue bars are 'positive'
    add to ONE red bar the QwtPlotItem::ItemAttribute that it should be shown in legend, all other false
    add to ONE blue bar the QwtPlotItem::ItemAttribute that it should be shown in legend, all other false

Similar Threads

  1. qwtlegend
    By Surfman19 in forum Qwt
    Replies: 6
    Last Post: 6th August 2015, 20:02
  2. Replies: 5
    Last Post: 26th June 2015, 16:00
  3. QwtLegend from trunk qwt
    By carhun in forum Qwt
    Replies: 2
    Last Post: 30th January 2013, 22:12
  4. Qwt 6.1.0 trunk and QwtLegend
    By carhun in forum Qwt
    Replies: 0
    Last Post: 22nd August 2012, 10:13
  5. QwtPolarMarker and QwtLegend
    By lokida in forum Qwt
    Replies: 4
    Last Post: 29th March 2011, 10:00

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.