Results 1 to 5 of 5

Thread: One QwtScaleDraw to Rule-Them-All?

  1. #1
    Join Date
    Feb 2006
    Posts
    5
    Platforms
    Windows

    Default One QwtScaleDraw to Rule-Them-All?

    One-axis-to-rule-them-all.jpg

    Hello,

    I have a vertical QwtScaleDraw on the left along with several qwt Plots in a QtBoxLayout. Each of the Qwt Plots has a title and a bottom axis which are the same units, width, etc. (see the attached image). In the interest of preserving screen real-estate, I would like them to share one QwtScaleDraw vertically on the left, which has a range from 0 to 360 degrees. My question is how can I make the scale on the left match the contents of the qwt plots and *not* include the title and bottom-scales on the individual qwt plots?

    I hope that makes sense?

    Thanks,

    Craig Steury

  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: One QwtScaleDraw to Rule-Them-All?

    Maybe check the plotmatrix example.

    Uwe

  3. #3
    Join Date
    Feb 2006
    Posts
    5
    Platforms
    Windows

    Default Re: One QwtScaleDraw to Rule-Them-All?

    The plot matrix example was my starting point (the example programs are very helpful, BTW). I started by putting all the individual plots in a layout and only enabling the axis for the leftmost plot. In this case the left axis was aligned perfectly with the plot-data The problem here was that the axis took some of the real-estate from the leftmost plot, so that it had less width than the other plots, even though it represents the same horizontal distance. At this point I decided to try adding an 'independent' QwtScaleWidget to the layout which would correspond to the other plots/channels data. However the scale no longer corresponds to the data as can be seen in the image. I've experimented with QwtScaleWidget::setBorderDist and can get pretty close by eyeballing it. I would like to get the appropriate 'BorderDist' by querying the top/bottom titles for their size(height), bounding-box or something like that so that when the plot is resized it will adjust appropriately. So this brings me to my main question: Can anyone recommend a good way to do that?

    Since these plots are supposed to represent a flattened pipe-line (and the boxes 'features' on the pipeline), the next thing will be to add a scrollbar, wheel, slider etc so that the view will scroll-around the pipe. My initial thought was to draw from -360 to 720 degrees and then draw the features in triplicate so that features that 'straddle' the seam will be drawn correctly (and not be cutoff at 0 or 360 degrees). In that case the views will represent a 'window' on the larger drawing. In that case I would like to update the QwtScaleWidget axis to match the current window of data. (say from -100 to 260 degrees)

    In any case, thanks in advance for any suggestions or comments.

    cs

  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: One QwtScaleDraw to Rule-Them-All?

    Quote Originally Posted by csteury View Post
    The problem here was that the axis took some of the real-estate from the leftmost plot, so that it had less width than the other plots, even though it represents the same horizontal distance
    Calculating the horizontal layout manually ( simply overloading the resizeEvent from the parent ) with taking care of some extra space for the leftmost scale sounds like a much easier approach to me than trying to add an external vertical scale. The extra space should correspond to the width of the left scale widget.

    Should be much easier, than your approach what more or less means, that you have to reimplement parts of the layout engine. But if you want to go this route check the code in QwtPlotLayout.

    Uwe

  5. #5
    Join Date
    Feb 2006
    Posts
    5
    Platforms
    Windows

    Default Re: One QwtScaleDraw to Rule-Them-All?

    Ok - easier is definitely a virtue - I will try that first.

    Thanks for the suggestion!

    cs

Similar Threads

  1. QwtScaleDraw for yaxis
    By mikrocat in forum Qwt
    Replies: 6
    Last Post: 25th January 2016, 07:54
  2. QwtScaleDraw class not working
    By Tomas_Zajic in forum Qwt
    Replies: 1
    Last Post: 26th August 2015, 16:57
  3. Problem with QwtScaleDraw
    By kanzaky in forum Qwt
    Replies: 3
    Last Post: 7th May 2013, 13:42
  4. LayoutDirectoin of QwtScaleDraw
    By jesse_mark in forum Qwt
    Replies: 1
    Last Post: 2nd November 2012, 08:31
  5. Replies: 1
    Last Post: 14th October 2010, 19:56

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.