Results 1 to 3 of 3

Thread: How to idenfity which move was performed by a zoom event

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to idenfity which move was performed by a zoom event

    Hello Uwe!

    As you may remember, I'm using QwtPlotTradingCurve to display a chart graph. I noticed that one must use setSymbolExtent() in order to define the width of the candlestick, and that such width is kind of a parameter that changes when the Qwt::xBottom changes (if everything is right...). Now the problem is that I noticed that putting the setSymbolExtent() value to the one presented in the stockchart example (12 * 3600 * 1000.0) is only good when the stock is quite zoomed out; but when we zoom in, one can begin to noticed that the candles are too far away from each other.

    So I guess I should change the setSymbolExtent() value each time a zoom movement is performed. The problem is that I need to know if the zoom event was a zoom in or a zoom out (so to know if a must call
    Qt Code:
    1. graphCandleCurve->setSymbolExtent( graphCandleCurve->symbolExtent() * 1.1f );
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. graphCandleCurve->setSymbolExtent( graphCandleCurve->symbolExtent() * 0.9f );
    To copy to clipboard, switch view to plain text mode 
    for example. My question is: is there a way to know if the zoom event is a zoom in or a zoom out with the Qwt library alone?

    Thanks,

    Momergil

    Obs.: consider QwtPlotZoomer and QwtPlotMagnifier at least.

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

    Default Re: How to idenfity which move was performed by a zoom event

    Quote Originally Posted by Momergil View Post
    So I guess I should change the setSymbolExtent() value each time a zoom movement is performed. The problem is that I need to know if the zoom event was a zoom in or a zoom out (so to know if a must call
    No, if you need to adjust the extent, calculate it from the current scale - it is not important what the previous scale or the previous value of the extent was.

    Simply connect to the QwtScaleWidget::scaleDivChanged() signal ( you already know how to do it ). With QwtPlot::axisScaleDiv() you find out what the current scale boundaries are.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Momergil (2nd February 2013)

  4. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to idenfity which move was performed by a zoom event

    Quote Originally Posted by Uwe View Post
    Simply connect to the QwtScaleWidget::scaleDivChanged() signal ( you already know how to do it ). With QwtPlot::axisScaleDiv() you find out what the current scale boundaries are.

    Uwe
    Sorry, but I wasn't able to understand how such boundaries can tell me if I need to make the candles's width fatter or thinner and how much. Could you tell me a little bit more abou this methodology?

Similar Threads

  1. Replies: 1
    Last Post: 3rd August 2011, 01:14
  2. Replies: 4
    Last Post: 27th September 2010, 11:28
  3. Problem in Move Move Event Handler.
    By redgoof in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 11:45
  4. Qwt zoom vs. Qt move
    By user in forum Qwt
    Replies: 6
    Last Post: 14th November 2007, 21:09
  5. Mouse Move Event
    By merry in forum Newbie
    Replies: 5
    Last Post: 3rd June 2007, 06:26

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.