Results 1 to 7 of 7

Thread: Multiscale plot

  1. #1
    Join Date
    May 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Multiscale plot

    Hi,

    I am new on this forum and in Qt/Qwt as well.
    I would like to know if is there any possibility to make a multiscale plot these days? By 'these days' I mean that I have seen this topic: http://www.qtcentre.org/forum/f-qwt-...ighlight=plots and Uwe wrote that it's not actually possible but it was 2 year's ago. So I'm asking now, can it be done? Multiscale plot has to be probably the most important feature in my project so I need to know that. Otherwise I have to write my own solution, but I'm getting headache when I'm thinking about it. Would be better to use the Qwt library.

    Thank you in advance for any help.

  2. #2
    Join Date
    May 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiscale plot

    I've actually found, let's say, a partial solution (the QwtPlotScaleItem class, which has been introduced in 5.1.0 version), but now I don't know how to change the colour of scale or the values. When I try methods such as setPalette or scaleDiv (which I think is for scale change) there is no effect.

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiscale plot

    The scale item has its own palette, that is assigned with scaleItem->setPalette(). Backbone and ticks are painted with the foreground color, the labels are painted with the text color ( as long as YourScaleDraw::label doesn't return a text object with an individual color ).

    Some time ago a user had sent me a patch that allows having 8 axes ( 2 in each direction ). I will have a look at it this weekend. If it can be ported to Qwt 5.1 I will add it to the patches section on the Qwt project page. I guess it should be possible to modify it to support more axes too.

    Uwe

  4. #4
    Join Date
    May 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiscale plot

    Thank you for your reply. It helped me a lot. I guess the QwtPlotScaleItem class will be enough for me for now.


    Here's also a couple lines of code for those who might look for the solution:
    Qt Code:
    1. QPalette *p = new QPalette();
    2. p->setBrush(QPalette::Text, QBrush(Qt::red));
    3. p->setBrush(QPalette::WindowText, QBrush(Qt::red));
    4. scaleItem->setPalette(*p);
    5. scaleItem->setFont(QFont (tr("blabla"), 10, 1, TRUE));
    6. scaleItem->setScaleDivFromAxis(FALSE);
    7. scaleItem->setScaleDiv((new QwtLinearScaleEngine())->divideScale(-28, 440, 5, 5));
    8. scaleItem->setBorderDistance(2);
    9. scaleItem->attach(myPlot);
    To copy to clipboard, switch view to plain text mode 
    which generates a red scale with red labels from -28 to 440.

  5. #5
    Join Date
    May 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiscale plot

    Quote Originally Posted by Uwe View Post
    Some time ago a user had sent me a patch that allows having 8 axes ( 2 in each direction ). I will have a look at it this weekend. If it can be ported to Qwt 5.1 I will add it to the patches section on the Qwt project page. I guess it should be possible to modify it to support more axes too.

    Uwe
    I just would like to ask, how goes the thing with more than 2 scales per axis? I've checked the newest 5.1.1 version and I haven't seen any changes.

    thanks in advance for info.

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiscale plot

    The patch is available, but I don't know myself how useful it is.

    Uwe

  7. #7
    Join Date
    May 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiscale plot

    Quote Originally Posted by Uwe View Post
    The patch is available, but I don't know myself how useful it is.

    Uwe
    Thanks for your reply, but I need some more infos.

    The patch is for six new Y-axes and I reimplemented it for 10 new X-axes (because I need more X instead of Y) so there's 12 X-axes for now and it even works.
    But there's a small bug cause when I try to enable some new axis, then every axis is in the same place (like on the stack). I suppose it is problem with computing new coordinates for axes. Could you tell me where I could find a method which computes coordinates for every axis or better how to fix this?

Similar Threads

  1. Replies: 15
    Last Post: 27th May 2008, 01:46
  2. Double Buffering for plot graphs
    By Tavit in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 13:10
  3. Qwt plot problem on compile
    By sincnarf in forum Qwt
    Replies: 2
    Last Post: 14th October 2007, 11:36
  4. My scientific plot problem
    By baray98 in forum Qt Programming
    Replies: 2
    Last Post: 5th August 2007, 15:01
  5. How to plot a graph in Qt ?
    By vinod in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2006, 13:44

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.