Results 1 to 2 of 2

Thread: Custom X-axis scale, auto-scale Y-axis for many Curves

  1. #1

    Default Custom X-axis scale, auto-scale Y-axis for many Curves

    I'm building a real-time plot that updates a few times a second and shows a particular window of data (usually the end of the plot) specified by an X-value range (usually from Last-N to Last). My initial approach was to iterate through each of the Curves (for which there are up to 25) and calculate the plot's boundingRect before each replot.

    After reading some posts on the forum, I decided a better approach would be to simply use setAxisScale on the QwtPlot for the x-axis and hopefully the QwtPlot would be smart enough to properly scale the Y-Axis to fit the data. While the x-axis scale looks correct, the y-axis is always set to the min/max of my whole dataset and is not restricted to just the data within the custom x-axis bounds.

    Am I missing something?

    My code is basically:

    setAxisScale(xButtom, 0.0, 200.0, 0);
    setAxisAutoScale(yLeft);


    Any help on this is appreciated.

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

    Default Re: Custom X-axis scale, auto-scale Y-axis for many Curves

    Quote Originally Posted by unomystEz View Post
    While the x-axis scale looks correct, the y-axis is always set to the min/max of my whole dataset and is not restricted to just the data within the custom x-axis bounds
    Yes this is exactly how the autoscaler works - it uses the interval from the bounding rectangle of the curve.

    In your case autoscaling doesn't make any sense and you better calculate the range for the y axis, when setting the range for the x axis - also using setAxisScale() for the y axis. As your points are ordered according to the x coordinates qwtUpperSampleIndex() might help for finding the samples you have to iterate.

    But be aware, that your approach will result in a plot that jumps heavily - several times a second !

    Uwe

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

    ccbaci (19th September 2013)

Similar Threads

  1. Qwt x axis scale value are colliding?
    By sonulohani in forum Qt Programming
    Replies: 2
    Last Post: 4th June 2012, 06:50
  2. qwt axis scale
    By Markus_AC in forum Qwt
    Replies: 0
    Last Post: 15th December 2011, 10:45
  3. Axis Auto Scale
    By gkarthick5 in forum Qwt
    Replies: 3
    Last Post: 13th July 2011, 14:57
  4. Replies: 4
    Last Post: 16th January 2011, 11:32
  5. 4 axis auto scale..
    By Vincenzo in forum Qwt
    Replies: 0
    Last Post: 22nd March 2009, 02:12

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.