Results 1 to 2 of 2

Thread: QWT plot with autoscaling shows negative values in y-axis

  1. #1
    Join Date
    Nov 2016
    Posts
    1
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QWT plot with autoscaling shows negative values in y-axis

    Hi,

    I have a QWT plot which shows only positive data values as a curve. I want autoscaling to be done since the values are not fixed in a range. But when autoscaling is enabled for y-left axis, then y-axis starts with negative values. how can i avoid this?

    setAxisAutoScale(QwtPlot::yLeft,true);

    I tried changing void QwtPlot::updateAxes() in my own class but facing issues because of d_axisData[axisId] private data.

    Thanks

  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: QWT plot with autoscaling shows negative values in y-axis

    Autoscaling means, that you want to calculate the scales from a given interval ( the bounding interval of all plot items having the QwtPlotItem::AutoScale flag enabled ). The algorithm for this calculation is implemented in the scale engine - usually QwtLinearScaleEngine::autoScale().

    If you are not happy with the result of the algorithm you have 2 options:


    • overload QwtLinearScaleEngine::autoScale
    • not using autoscaling and doing setAxisScale instead


    The code you would have to write is more or less the same.

    Uwe

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

    manikandan (1st December 2016)

Similar Threads

  1. Cannot get the axis's current min and max values
    By Alexander111122 in forum Qwt
    Replies: 2
    Last Post: 24th February 2016, 16:18
  2. Replies: 2
    Last Post: 18th October 2015, 11:17
  3. QwtCurveFitter and negative axis
    By bisasatan in forum Qwt
    Replies: 3
    Last Post: 23rd February 2013, 12:46
  4. Replies: 9
    Last Post: 3rd May 2011, 22:21
  5. How to zoom in negative X and Y axis ?
    By biplab777 in forum Qwt
    Replies: 0
    Last Post: 9th June 2009, 11:55

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.