Results 1 to 6 of 6

Thread: Help: How to add QwtPlotMarker at a FIX position?

  1. #1
    Join Date
    Feb 2009
    Posts
    51
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Help: How to add QwtPlotMarker at a FIX position?

    Hi,

    I have a plot (derived from the bode example) that can plot multiple curves. I am trying to put legends on either upper left or upper right corner of the canvas to show the name and color of each curve using QwtPlotMarker. Once I added the legends, I want them to stay exactly at the same location but couldn't make it work. Every time user zoom in/out, the legends position changes (sometime out of display), Or every time user append a new curve, the scale changes and the legend position also change

    Is there anyway to make the legends appear at a fixed place on the canvas? Is QwtPlotMarker the right way to use (I want a color line with text next to it to show the name of the curve and the color of the curve)?

    Thank so much for all your help.
    Sincerely,

    Wieland J.

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Help: How to add QwtPlotMarker at a FIX position?

    there is a simple solution: use the other axes for the markers! Your zoomer zooms QwtPlot::xBottom/QwtPlot::yLeft. QwtPlot::xTop/QwtPlot::yRight remain unchanged. Now you set a simple scale fot xTop/yRight and set the values for your markers depending on these scales.

    hope this helps
    Felix

  3. #3
    Join Date
    Feb 2009
    Posts
    51
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Help: How to add QwtPlotMarker at a FIX position?

    Thanks, Felix, for you response. Unfortunately I use both Y-axes for my plot (to plot main curves and their corresponding integrals). Your input is highly appreciated though.

    Any other?
    Sincerely,

    Wieland J.

  4. #4
    Join Date
    Feb 2009
    Posts
    51
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Help: How to add QwtPlotMarker at a FIX position?

    Anybody, please?
    Sincerely,

    Wieland J.

  5. #5
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Help: How to add QwtPlotMarker at a FIX position?

    ok, next idea: you have to work with canvas pixel.

    first, you have to find the pixel position where your legend should appear (remember: in pexels, (0/0) is top-left)
    second, translate this position into axis values using qwtplot::transform or qwtplot::invtransform (sorry, I'm always confused which one translates in which direction...)
    third, do second step after each zoom (the zoomer emits a "zoomed(...)"-signal which you can connect to a custom slot)

    have fun
    Felix

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

    Default Re: Help: How to add QwtPlotMarker at a FIX position?

    Check the CpuPieMarker from the cpuplot example. Instead of the pie draw your legend.

    Uwe

Similar Threads

  1. QwtPlotMarker example
    By banita in forum Qwt
    Replies: 1
    Last Post: 24th May 2012, 13:19
  2. Automatic rescale QwtPlotMarker
    By gpsgek in forum Qwt
    Replies: 0
    Last Post: 23rd May 2010, 16:26
  3. Replies: 5
    Last Post: 25th November 2009, 12:55
  4. QwtPlotMarker segfault
    By viridis in forum Qwt
    Replies: 4
    Last Post: 17th September 2008, 13:22
  5. QwtPlotMarker confusion
    By baray98 in forum Qwt
    Replies: 3
    Last Post: 20th July 2008, 09:47

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.