Results 1 to 3 of 3

Thread: Virtual axis ?

  1. #1
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    5
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Virtual axis ?

    Hello,

    I have multiple curves with very different min/max values. Thus, when I plot them, I have curves which are displayed as horizontal lines which is quite useless...

    As Qwt does not support multiple Y axis (I have lot of curves so 2 axis is not sufficient),
    what I want to do is to graduate the YAxis according to the selected curve in the legend (assuming that we can selected only one curve at a time) but display all the curve with their own axis which will be invisible.
    This way, all curves will be displayed "maximized" and to know the value of a curve point, I will just have to selected the corresponding curve in the legend and then look at the YAxis.

    I did not find a easy way to do this. As I a my own QwtData, I think about returning "faked" Y values according to the selected curve and the zoom rect, but there is maybe an better way to do this ?

    Idealy I want a zoom which works on all curves, not only the selected one, but I can do without that.

    Regards,

  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: Virtual axis ?

    Thw QwtScaleMaps are responsible for translating curve points into pixel positions. What you could try is to overload QwtPlotCurve::draw and manipulate the scale interval of the y-map individually for each curve.

    Uwe

  3. #3
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    5
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Lightbulb Re: Virtual axis ?

    Thanks a lot, it works !

    I have redefine :

    Qt Code:
    1. void MyPlotCurve::draw (QPainter* painter, const QwtScaleMap& xMap, const QwtScaleMap& yMap, int from, int to) const
    2. {
    3. QwtScaleMap newYMap (yMap);
    4. newYMap.setScaleInterval (minYValue (), maxYValue ());
    5. QwtPlotCurve::draw (painter, xMap, newYMap, from, to);
    6. }
    To copy to clipboard, switch view to plain text mode 

    and for each of my curves I do
    Qt Code:
    1. myCurve->setItemAttribute (QwtPlotItem::AutoScale, false)
    To copy to clipboard, switch view to plain text mode 

    next, each time I want to change the grading to correspond to a curve, I just do
    Qt Code:
    1. myPlot->setAxisScale (QwtPlot::yLeft, myCurve->minYValue (), myCurve->maxYValue ())
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Cost of pure virtual
    By ShaChris23 in forum General Programming
    Replies: 4
    Last Post: 4th November 2007, 19:20
  2. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 15:13
  3. Compiling error
    By vfernandez in forum Newbie
    Replies: 2
    Last Post: 9th March 2007, 22:02
  4. inheritance, pure virtual
    By TheKedge in forum General Programming
    Replies: 2
    Last Post: 18th January 2007, 12:20
  5. link error for visual studio.net 2003
    By berlin in forum Newbie
    Replies: 9
    Last Post: 29th September 2006, 17:06

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.