Results 1 to 14 of 14

Thread: Qwt with multi axes support

  1. #1
    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 Qwt with multi axes support

    As multi axes support is one of the feature requests that pop up from time to time:

    there is a new implementation in a special branch: http://sourceforge.net/p/qwt/code/HE...-6.1-multiaxes. Even if not 100% complete ( some layout code issues with long titles + QwtPlotRescaler is not yet working ) it should be much better than any of the patches for earlier versions of Qwt.

    The Qwt examples work with this version, so the API changes should be more or less painless for most of the application code. So I'm considering to have it in Qwt 6.2, but I'm not decided yet.

    Reporting bugs or commenting the API can be done on the Qwt mailing list ( or here ).

    Uwe

  2. #2
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: Qwt with multi axes support

    Dear Uwe,

    I am most grateful that you have chosen to pursue this.
    I work on the GoldenCheetah project and we have been maintaining our own patched version of QWT.
    I am (right now) porting our code to QT 5.1.1 and was preparing to update our maintained QWT to 6.1 + multiaxis patch.

    I will go and read the code and try better to understand the new APIs in SVN.

    Am I right to assume that this means you can have multiple axes (more than one axis) on the left, right, top and bottom of each plot ?

    Thanks,
    Mark

  3. #3
    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 with multi axes support

    Quote Originally Posted by liversedge View Post
    Am I right to assume that this means you can have multiple axes (more than one axis) on the left, right, top and bottom of each plot ?
    As many as you want to.

    Uwe

  4. #4
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: Qwt with multi axes support

    Apologies -- I couldn't work out how to delete a post.
    I answered my own questions
    Last edited by liversedge; 10th December 2013 at 23:15. Reason: answered my own question!

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


  6. #5
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: Qwt with multi axes support

    Well, after playing with it for a while I am very happy, here is a screenshot of it in action in our program.

    Screenshot from 2013-12-11 19:55:45.jpg

    Two little things;
    - xBottom seems to disappear whenever another pos axis is modified.
    - QwtPlot::canvas() doesn't return a QwtPlotCanvas anymore (I needed to static_cast<> to be able to setFrameStyle(QFrame::NoFrame);

    But thanks -- this is absolutely brilliant for us in GoldenCheetah !

  7. #6
    Join Date
    Dec 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt with multi axes support

    I found a bug
    in file qwt_plot_renderer.cpp
    in line 555: for ( int i = 0; i < plot->axesCount( i ); i++ )
    should be : for ( int i = 0; i < plot->axesCount( axisPos ); i++ )
    could you fix this asap, thanks

  8. #7
    Join Date
    Dec 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt with multi axes support

    similliar bug
    after set few multiaxes (yLeft ) and change their color by using set palette ( with using stylesheet for all widget - without set style everything works fine ) changed is only one scale (color)
    call function to set new one ( by push button click - after some part of time - probably event get update)
    old scales get change their color but - new added not - replot update etc. in this function do not work.
    I workaround this by changing color by set style for scale widget - but in future better way is to set this by paletts.

  9. #8
    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 with multi axes support

    similliar bug
    after set few multiaxes (yLeft ) and change their color by using set palette ( with using stylesheet for all widget - without set style everything works fine ) changed is only one scale (color)
    call function to set new one ( by push button click - after some part of time - probably event get update)
    Not sure how this might be comparable to the bug above.

    old scales get change their color but - new added not - replot update etc. in this function do not work.
    I workaround this by changing color by set style for scale widget - but in future better way is to set this by paletts.
    Setting a palette and how new widgets are initialized is part of the Qt framework. Setting a palette to one scale widget of course doesn't affect the palette of another scale widget, but setting a palette to the parent of the scale widgets ( the plot widget itself ) would have an effect. When also setting a palette to legend and titles ( the canvas usually has its own ) and no palette to the scales, then only the scale widgets - but all of them - would inherit the palette from the plot widget.

    When working with style sheets you might be interested in the names of the scale widgets:


    • "QwtPlotAxisYLeft", "QwtPlotAxisYLeft1", " "QwtPlotAxisYLeft2" ...
    • "QwtPlotAxisYRight", "QwtPlotAxisYRight1", "QwtPlotAxisYRight2", ...
    • "QwtPlotAxisXBottom", "QwtPlotAxisXBottom1", "QwtPlotAxisXBottom2", ...
    • "QwtPlotAxisXTop", "QwtPlotAxisXTop1", "QwtPlotAxisXTop2"



    HTH,
    Uwe

  10. #9
    Join Date
    Dec 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt with multi axes support

    Similiar is that: change get affect only on first ( default scale ), ( eg.
    step I:
    create plot - set own style sheet on the plot widget, plot is created with default scales, xLeft, yLeft
    after create Plot, create Y curves ( set them own color's - from table of colors every uniqe )
    step II
    call setAxesCount to set for every curve thier own scale and set color of the scale the same as it's curve

    QwtScaleWidget *scalewidget = qwtPlot->axisWidget(axisid);
    QPalette pal = scalewidget->palette();
    pal.setColor(QPalette::Text, pen().color());
    scalewidget->setPalette(pal);

    efect: only first scale get color changed (so code is good and there is bug)
    step III
    from pushbutton clicked
    change number of curves to Y2 where Y2 > Y
    reapeat step II for Y2

    efect: change is have afect only for Y number of curves ( not Y2 )


    workaround for step II:
    QString stylesheet = scalewidget->styleSheet();
    ..
    stylesheet.replace change for style I changed color: #rgb;
    ..
    scalewidget->setStyleSheet(stylesheet);

    for end:
    first code without using stylesheet on the plot widget works fine, problem occurs while use stylesheet to change overlook and then you what to change from code some details
    Last edited by darkshu; 31st October 2014 at 07:46.

  11. #10
    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 with multi axes support

    Not sure if I understood everything, but isn't it like this:

    a) plot and first scale widget created with application palette
    b) setting a stylesheet for the plot, scale widget still using default palette
    c) adding new scale widgets, stylesheet now derived from plot widget ( palette disabled )

    Call it good or bad - this is how it is defined by Qt. The stylesheet concept has its problems and I would recommend to use style sheets for all or nothing.

    Uwe

  12. #11
    Join Date
    Dec 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt with multi axes support

    Quote Originally Posted by Uwe View Post
    Not sure if I understood everything, but isn't it like this:

    a) plot and first scale widget created with application palette
    b) setting a stylesheet for the plot, scale widget still using default palette
    c) adding new scale widgets, stylesheet now derived from plot widget ( palette disabled )

    Call it good or bad - this is how it is defined by Qt. The stylesheet concept has its problems and I would recommend to use style sheets for all or nothing.

    Uwe
    a) qapp->setStyleSheet(xxx);
    b) qMainWindow
    c) plot - there is no own stylesheet - qwtplot get it from qwidget ( background, color, font etc. ) from main style
    d) adding new scale widgets with style scheet derivet from parent ( plot widget )
    I cant say that palette is disabled becouse part of scaleas react on changing palette - other not, Number of scales that changing palette is depend of previus call setAxesCount
    replot, or other ways to update it in that step of time don't get effect
    e) changing setScaleCount from qpushbutton action ( click ) change number of scales reacting on set palette ( but always its wrong nuber of it - depend of previus call setAxesCount)
    f) in my current project using stylesheet for all is enought, but direct reference to setting gives you more options than offers using stylesheet

  13. #12

    Default Re: Qwt with multi axes support

    Hello everyone! How i can hide axis.
    enableAxis(yLeft,false); - works for the first left axis only. But i have four yLeft axis.
    Thank you.

  14. #13
    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 with multi axes support

    Qt Code:
    1. plot->setAxisVisible( QwtAxisId( yLeft, ... ), false );
    To copy to clipboard, switch view to plain text mode 
    HTH,
    Uwe

  15. #14

    Default Re: Qwt with multi axes support

    THank you !

Similar Threads

  1. Multi-page tiff image support for qimage
    By Johnny in forum Qt Programming
    Replies: 1
    Last Post: 5th January 2013, 17:15
  2. QVFB multi language support
    By vivek.panchal in forum Qt Programming
    Replies: 0
    Last Post: 10th October 2012, 15:48
  3. Patch Multi Axes Zoom
    By oddytz1989 in forum Qwt
    Replies: 4
    Last Post: 1st February 2012, 12:17
  4. multi language support example
    By Ratheendrans in forum Qt Programming
    Replies: 6
    Last Post: 3rd April 2011, 03:50
  5. Can a QListView support multi-column?
    By wesley in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2008, 09:00

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.