Results 1 to 3 of 3

Thread: QwtPlot fixed X-axis display

  1. #1
    Join Date
    Nov 2010
    Posts
    7
    Thanks
    4

    Default QwtPlot fixed X-axis display

    I am displaying a large amount of data on a graph, comprising thousands of points.
    I display discrete sections of the graph by modifying the X-axis scale as follows :-

    setAxisScale(QwtPlot::xBottom, selectedRegion, selectedRegion+singleIncrement);

    By default, the X-axis displays the X-value of the selected range, e.g. 10500 to 10600.

    Is it possible to modify the X-axis display to ALWAYS show the range 0 to 100, regardless of the selected area?

    Thanks.

  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: QwtPlot fixed X-axis display

    of course. you set the axisScale of QwtPlot::xBottom to range 0-100. Then you have to use QwtPlot::xTop as xAxis for your data curves.

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

    micc13 (3rd December 2010)

  4. #3
    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: QwtPlot fixed X-axis display

    Quote Originally Posted by micc13 View Post
    Is it possible to modify the X-axis display to ALWAYS show the range 0 to 100, regardless of the selected area?
    I recommend to use a fixed scale of 0-100 always - but implement your own type of QwtData object, that is aware of the range changes. Beside, that you can simply subtract the minimum of the range in YourData::x() you could also reduce the number of points, that needs to be painted. When your samples are ordered in x-order identifying all points that are in the current range should be pretty fast and you can improve the performance of your plot widget heavily.

    Another solution is to implement your own type of QwtScaleDraw ( check the cpuplot example ), where you manipulate the mapping of a value to its label. But this doesn't improve any performance.

    Uwe

    PS: When you don't want to follow my advice you should at least enable QwtPlotCurve::ClipPolygons

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

    micc13 (3rd December 2010)

Similar Threads

  1. QwtPlot Change Axis Title Alignment
    By deepy in forum Qwt
    Replies: 5
    Last Post: 20th October 2010, 14:40
  2. Replies: 1
    Last Post: 16th March 2010, 16:23
  3. Replies: 1
    Last Post: 5th January 2010, 22:00
  4. QwtPlot axis decmials/notation
    By dfirestone in forum Qwt
    Replies: 1
    Last Post: 1st May 2009, 11:42
  5. fixed axis scales
    By oskarmellow in forum Qwt
    Replies: 1
    Last Post: 17th December 2008, 07:20

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.