Results 1 to 8 of 8

Thread: My own scale widget in Qwt

  1. #1
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default My own scale widget in Qwt

    Anybody knows how to create custom scale widget for plot in Qwt (I need to put on it my own values) ? And how to create multiscale plots (one y scale for each curve) ?

  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: My own scale widget in Qwt

    1) Custom scales are possible.

    If you tell me more details about Qt/Qwt versions and what you want to do in detail, I should be able to help.

    2) Multiple Y-Scales

    Qwt supports 2 Y scales (left + right) out of the box. If you need more than 2 Y scales you need a very deep understanding how the Qwt classes work together. I know that a couple of people hacked such a beast, but I don't recommend to try it. Better try to find a solution with 2 scales only.

    HTH,
    Uwe

  3. #3
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: My own scale widget in Qwt

    Quote Originally Posted by Uwe
    1) Custom scales are possible.

    If you tell me more details about Qt/Qwt versions and what you want to do in detail, I should be able to help.

    2) Multiple Y-Scales

    Qwt supports 2 Y scales (left + right) out of the box. If you need more than 2 Y scales you need a very deep understanding how the Qwt classes work together. I know that a couple of people hacked such a beast, but I don't recommend to try it. Better try to find a solution with 2 scales only.

    HTH,
    Uwe
    Thank you, Uwe.

    1) I'm using Qt 4.1.3 open source edition and Qwt snapshot 20060130.

    Generally what i have to do:

    I have three arrays: index, parameter value and time. Parameter value and time are functions of index (time must be linear function). Because of noise in telemetry channel there are many errors in time data. It makes impossible to plot (time, value). I have to plot (index, value) and put time ticks (where it is possible) on the bottom scale.

    Generally index is the real stable "time", but user must see minutes and seconds.

    2) I think, variant with 2 Y scales is not mine. I need to plot 3 and more curves in that manner. If I will not be able to understand Qwt classes interaction it would be better to find another solution for me (such as multiple plots instead of multiple scales).

  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: My own scale widget in Qwt

    Quote Originally Posted by igrms
    Generally index is the real stable "time", but user must see minutes and seconds.
    Have a look at the cpuplot example of Qwt.

    Uwe

  5. #5
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: My own scale widget in Qwt

    Quote Originally Posted by Uwe
    Have a look at the cpuplot example of Qwt.

    Uwe
    Thank you.

    But I need much more control of the scale widget.

    Normally my widget must look like this:
    0---1---2---3---4---5---6

    But in my case time is not perfectly linear and it can look so:
    0---1---2--3---4---5---6

    This case is very bad. Time counter is surprisely reseted:
    0---1---xxxx0---1---2---6 (xxxx --- fail --- descending time)

    That is why I need to divide scale, count values and maybe draw it by myself.

    Can I do it in Qwt ?

  6. #6
    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: My own scale widget in Qwt

    Sounds like you need 2 things:

    1) Display your own labels
    2) Irregular division of your scale

    How to do 1) can be seen in the cpuplot example.
    For 2) you can use QwtPlot::setAxisScaleDiv. If there is a rule behind how to calculate your scale divison, it might be worth to write it down as a QwtScaleEngine.

    HTH,
    Uwe

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

    igrms (15th June 2006)

  8. #7
    Join Date
    May 2006
    Location
    Bangalore
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: My own scale widget in Qwt

    I agree with UVE, in that you have to use QwtPlot::setAxisScaleDiv() to be able to have variable distances between your labels on your scale. For that you need to have some sort of calculation of knowing what your scale would look like at any given instance.

    Now displaying label part should be easy.
    If you want to display your own labels, you can subclass QwtScaleDraw and reimplement label (double).
    Obviously, you will have to tell your QwtPlot about your new QwtScaleDraw implementation by using QwtPlot::setAxisScaleDraw().

    Inside label(), you can even have a mapping of the 'double' argument with your label strings.

  9. The following user says thank you to bits for this useful post:

    igrms (15th June 2006)

  10. #8
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: My own scale widget in Qwt

    Thank you Uwe and bits. I think now I can do what I need with a bottom scale.

    And what can I do with multiple Y scales? I would like to try it. I think I'm not only one who need this useful thing.

Similar Threads

  1. Replies: 4
    Last Post: 24th March 2006, 23:50
  2. Forwarding mouse events to another widget.
    By yogeshm02 in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 14:25
  3. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 15:16
  4. advanced split widget
    By vitaly in forum Qt Programming
    Replies: 10
    Last Post: 24th January 2006, 21:00
  5. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 12:24

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.