Results 1 to 7 of 7

Thread: QwtPlotMultiBarChart not equal width

Hybrid View

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

    Default Re: QwtPlotMultiBarChart not equal width

    Looks like a bug to me - related to the disabled x axis.

    A possible workaround is to use the following code:

    Qt Code:
    1. #if 0
    2. enableAxis(xAxis, false);
    3. #else
    4. // workaround
    5. QwtScaleDraw *scaleDraw = axisScaleDraw( QwtPlot::xBottom );
    6. scaleDraw->enableComponent(QwtScaleDraw::Backbone, false);
    7. xAxis_scaleDraw->enableComponent(QwtScaleDraw::Ticks, false);
    8. xAxis_scaleDraw->enableComponent(QwtScaleDraw::Labels, false);
    9. #endif
    To copy to clipboard, switch view to plain text mode 

    HTH,
    Uwe

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

    nanthiran_2005 (27th June 2014)

  3. #2
    Join Date
    Jun 2014
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1

    Default Re: QwtPlotMultiBarChart not equal width

    Hi Uwe,

    Thanks for the help. The line which disable the label helps. However, I still have to manually set the margin of yLeft and yRight. Otherwise, the bar chart will not be equal of width.
    Attached below is the portion of code which help me to get the bar chart I want.

    Qt Code:
    1. QwtPlot::Axis yAxis = QwtPlot::yLeft,
    2. xAxis = QwtPlot::xBottom;
    3. setAxisScale(yAxis, 0, 100, 20);
    4. setAxisAutoScale(xAxis);
    5. enableAxis(yAxis, true);
    6.  
    7. QwtScaleDraw *yAxis_scaleDraw = axisScaleDraw(yAxis);
    8. yAxis_scaleDraw->enableComponent(QwtScaleDraw::Backbone, false);
    9. yAxis_scaleDraw->enableComponent(QwtScaleDraw::Ticks, false);
    10.  
    11. QwtScaleDraw *xAxis_scaleDraw = axisScaleDraw(xAxis);
    12. xAxis_scaleDraw->enableComponent(QwtScaleDraw::Backbone, false);
    13. xAxis_scaleDraw->enableComponent(QwtScaleDraw::Ticks, false);
    14. xAxis_scaleDraw->enableComponent(QwtScaleDraw::Labels, false);
    15.  
    16. plotLayout()->setCanvasMargin(0);
    17. plotLayout()->setCanvasMargin(20, QwtPlot::yLeft);
    18. plotLayout()->setCanvasMargin(20, QwtPlot::yRight);
    To copy to clipboard, switch view to plain text mode 
    Last edited by nanthiran_2005; 27th June 2014 at 12:52.

Similar Threads

  1. QwtPlotMultiBarChart with raw data
    By Momergil in forum Qwt
    Replies: 2
    Last Post: 14th May 2014, 17:27
  2. Stacked Curves - QwtPlotMultiBarChart
    By GG2013 in forum Qwt
    Replies: 2
    Last Post: 13th August 2013, 02:58
  3. Greater or equal than and smaller or equal than not working..
    By ruben.rodrigues in forum General Programming
    Replies: 3
    Last Post: 27th April 2011, 08:09
  4. What does Updatedata function in MFC equal with Qt?
    By nthung in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2010, 11:58
  5. Equal scales
    By sukram in forum Qwt
    Replies: 1
    Last Post: 22nd July 2008, 07:44

Tags for this Thread

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.