Results 1 to 4 of 4

Thread: QwtCurveFitter and negative axis

  1. #1
    Join Date
    Jun 2012
    Posts
    8
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default QwtCurveFitter and negative axis

    Hello everyone,

    I've just started using QWT and till now, everything worked great, but now I'm having a problem with negative values on the axis of a qwtplot and the curvefitter.
    I attached a lot of curves to my plot and there are two kinds of them: curves, which represent prices and therefore are always positive and curves, which represent price deviations, which can be negative and positive and therefore, if chosen, the axis has might have an interval of [-5.0; 5.0].
    I am adding a curvefitter to all curves on initialization and giving the user the option to "smooth" the curve, when already attached and shown by calling
    Qt Code:
    1. curve->setCurveAttribute(QwtPlotCurve::Fitted,true);
    To copy to clipboard, switch view to plain text mode 

    The problem: when i do this on the price-curves everything is fine, but when the deviation curves are chosen the curve gets partially drawn outside the visible area. I've attached 2 pictures to demonstrate the problem - the first shows the normal deviation curve (which is already drawn much nearer to the xAxis than the price curves) and the second shows the behaviour when QwtPlotCurve::Fitted was applied.

    My second problem is related to the first one: I dont know anything about interpolating curves and do not fully understand the Curvefitters - the first problem occurs, because the amplitude gets way out of boundaries when there is a dramatic change from rising to falling - is there a way to prevent this by setting the splicecount to a specific value or something like that?

    Thx in advance for any help - I hope I'm not missing something basic.

    no_fitter.jpg
    fitter.jpg

  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: QwtCurveFitter and negative axis

    Look like a Qwt bug to me. Please post a small standalone demo showing the problem.

    Uwe

  3. #3
    Join Date
    Jun 2012
    Posts
    8
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QwtCurveFitter and negative axis

    Hello Uwe,

    I've attached an example which shows one curve with drastically changing values -10; 160; -10 - when Fitter gets applied you'll see the effect.
    I hope, that's what you meant with standalone example.


    main.cpp
    plotsmooth.cpp
    plotsmoo.h

    EDIT: I've also realised, that it does not only happens with negative values - the fluctuation just has to be high enough.
    Last edited by bisasatan; 21st February 2013 at 22:27.

  4. #4
    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: QwtCurveFitter and negative axis

    Unfortunately the result of the implemented spline interpolation for your curve is pretty bad ...

    The implementation of the spline interpolation is the only piece of code that is left from Qwt 1.0 ( not written by me ) and I don't know the algorithms myself. But as far as I can see the amplitude changes when playing with some factors so it should be possible to offer parameters having an effect on the interpolation.

    There is enough documentation about spline interpolation available: f.e http://r.789695.n4.nabble.com/file/n905996/SPLINES.PDF - if someone is interested in improving QwtSpline ...

    Uwe

Similar Threads

  1. Problem with QwtCurveFitter
    By Crowley in forum Qwt
    Replies: 4
    Last Post: 25th October 2012, 08:13
  2. Replies: 9
    Last Post: 3rd May 2011, 22:21
  3. Replies: 0
    Last Post: 9th August 2010, 11:46
  4. Replies: 20
    Last Post: 22nd July 2010, 08:35
  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.