Results 1 to 5 of 5

Thread: Qwt: Using QwtPlotPicker on multiple plots

Hybrid View

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

    Default Re: Qwt: Using QwtPlotPicker on multiple plots

    Have a look at the implementation of PlotMatrix::alignVAxes in the plot matrix example; http://qwt.svn.sourceforge.net/viewv...pp?view=markup.

    The trick is to calculate the maximum extent of all vertical axes and to assign it to all of them.

    HTH,
    Uwe

    PS: Please start a new thread, when you ask for something completely different.

  2. #2
    Join Date
    Sep 2007
    Location
    Vienna, Austria
    Posts
    19
    Thanks
    10
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: Qwt: Using QwtPlotPicker on multiple plots

    yeah, that plotmatrix example also helped me alot,
    i had the same problem with aligning my plots vertically (if that is the problem you have) and i solved it like this way


    Qt Code:
    1. void myPlotFrame::paintEvent(QPaintEvent *pe)
    2. {
    3. QListIterator<QwtPlot*> it(myPlots); //i have a QList<QwtPlot*> for my plots
    4. QwtPlot *current_plot;
    5. int maxExtent = 0;
    6.  
    7. while (it.hasNext())
    8. {
    9. current_plot = it.next();
    10.  
    11. QwtScaleWidget *scaleWidget = current_plot->axisWidget(QwtPlot::yLeft);
    12. QwtScaleDraw *sd = scaleWidget->scaleDraw();
    13. sd->setMinimumExtent(0);
    14.  
    15. const int extent = sd->extent(
    16. QPen(Qt::black, scaleWidget->penWidth()),
    17. scaleWidget->font() );
    18. if ( extent > maxExtent )
    19. maxExtent = extent;
    20. }
    21.  
    22. it.toFront();
    23. while (it.hasNext())
    24. {
    25. current_plot = it.next();
    26. QwtScaleWidget *scaleWidget = current_plot->axisWidget(QwtPlot::yLeft);
    27. scaleWidget->scaleDraw()->setMinimumExtent(maxExtent);
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 

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
  •  
Qt is a trademark of The Qt Company.