Results 1 to 2 of 2

Thread: Scale Breaks in the QWT plot axis

  1. #1
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    39
    Thanks
    15
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Scale Breaks in the QWT plot axis

    I had a quick look and didn't find anything that seemed to cover this (apologies if i missed it).

    i wanted to know if it is possible to create scale breaks in the qwt plots. I ask because I have a data set that does not contain any points in a certain portion of the x-axis range e.g. data exists from 400-2500 & 6000-14000 but is absent from 2500-6000.
    So when I plot this i get my curves but they look a bit naff since there is this giant gap where my data doesn't exist.

    Any ideas, clues?

    Cheers
    Oz

  2. #2
    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: Scale Breaks in the QWT plot axis

    Quote Originally Posted by OzQTNoob View Post
    i wanted to know if it is possible to create scale breaks in the qwt plots. I ask because I have a data set that does not contain any points in a certain portion of the x-axis range e.g. data exists from 400-2500 & 6000-14000 but is absent from 2500-6000.
    You need to implement your own QwtScaleTransformation, mapping the unimportant intervals to a much smaller intervals on the paint device. In SVN trunk you find the scaleengine demo in the playground directory. It is for QwtTransform ( what will replace QwtScaleTransformation in Qwt 6.1 ), but you should get the idea what to do. Have a look at the "At 400" transformation, that extends an interval ( using pow() ) - fed with different parameters it is also able to shrink the interval.

    You also need to avoid having ticks in the areas of no interest. One solution is to calculate them manually and assign them QwtPlot::setAxisScaleDiv. If this is not possible ( f.e when you need zooming ) you need to overload QwtLinearScaleEngine::divideScale():

    Qt Code:
    1. virtual QwtScaleDiv YourScaleEnigine::divideScale( double x1, double x2,
    2. int maxMajSteps, int maxMinSteps, double stepSize ) const
    3. {
    4. QwtScaleDiv scaleDiv = QwtLinearScaleEngine::divideScale( x1, x2, ... );
    5.  
    6. // now remove/replace ticks from the dead areas
    7. return filteredTicks( scaleDiv );
    8. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

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

    OzQTNoob (10th May 2012)

Similar Threads

  1. qwt axis scale
    By Markus_AC in forum Qwt
    Replies: 0
    Last Post: 15th December 2011, 10:45
  2. Date Scale for X-Axis
    By mishani99 in forum Qwt
    Replies: 3
    Last Post: 6th September 2011, 12:40
  3. Replies: 9
    Last Post: 3rd May 2011, 22:21
  4. Replies: 4
    Last Post: 16th January 2011, 11:32
  5. qwp plot axis scale
    By Cal in forum Qwt
    Replies: 1
    Last Post: 11th May 2009, 18:10

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.