Results 1 to 3 of 3

Thread: Need space between bars in QwtPlotMultiBarChart

  1. #1
    Join Date
    Oct 2020
    Posts
    2
    Qt products
    Qt4 Qt5 Qt/Embedded PyQt3 PyQt4
    Platforms
    Unix/X11 Windows Android

    Default Need space between bars in QwtPlotMultiBarChart

    Hi everyone, I'm using QWT 6.2.0 and trying to draw bar chart using QwtPlotMultiBarChart. I took the reference of distrowatch example. I added a dummy (zero) values for the middle bar to increase the space between light blue bar and dark blue bar. But this is impacting the space between dark blue bar and the next light blue bar. I got the output but it is not up to the mark (as expected). I need three things to do.

    1) As shown in the output.jpg, I want to increase the space between dark blue bar and the next light blue bar.

    2) I'm calling QwtPlotRenderer.render(...) method to print this chart to PDF. But it is scaling the canvas only and not the X-Axis labels, Y-Axis values and chart title.

    3) I want to append units to the Y-Axis values. Right now it is just showing values only.

    Please help.
    Attached Images Attached Images

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

    Default Re: Need space between bars in QwtPlotMultiBarChart

    I want to increase the space between dark blue bar and the next light blue bar.
    You probably need to overload drawSample or drawBar. Have a look at the implementation of QwtPlotMultiBarChart and you will find your way.
    Would make sense to add a configurable spacing attribute to the API. Please add a feature request: https://sourceforge.net/p/qwt/feature-requests/

    I'm calling QwtPlotRenderer.render(...) method to print this chart to PDF. But it is scaling the canvas only and not the X-Axis labels, Y-Axis values and chart title.
    What type of fonts do you use: pixel vs. point size ?

    I want to append units to the Y-Axis values. Right now it is just showing values only.
    You have to overload QwtScaleDraw::label: https://qwt.sourceforge.io/class_qwt...41f4f06ec5442d

    HTH,
    Uwe

  3. #3
    Join Date
    Oct 2020
    Posts
    2
    Qt products
    Qt4 Qt5 Qt/Embedded PyQt3 PyQt4
    Platforms
    Unix/X11 Windows Android

    Default Re: Need space between bars in QwtPlotMultiBarChart

    Thank u, Uwe...

    Quote Originally Posted by Uwe View Post
    You probably need to overload drawSample or drawBar. Have a look at the implementation of QwtPlotMultiBarChart and you will find your way.
    Would make sense to add a configurable spacing attribute to the API. Please add a feature request: https://sourceforge.net/p/qwt/feature-requests/
    Will do this.


    What type of fonts do you use: pixel vs. point size ?
    Used default fonts. Haven't set any other font as of now. Below is the code snippet...

    QwtPlotRenderer renderer;

    renderer.setDiscardFlag(QwtPlotRenderer:iscardCanvasBackground, true);
    renderer.setDiscardFlag(QwtPlotRenderer:iscardCanvasFrame, true);
    renderer.setDiscardFlag(QwtPlotRenderer:iscardBackground, true);
    //renderer.setLayoutFlag(QwtPlotRenderer::FrameWithS cales, true);

    QString strFileName = m_pPDFPage->m_strFileName;
    renderer.renderDocument(pPlot, strFileName, plotRect.size(), 4);


    You have to overload QwtScaleDraw::label: https://qwt.sourceforge.io/class_qwt...41f4f06ec5442d
    I'm a new bee. I started learning to code using Qwt recently. Can u plz paste a sample code snippet for my understanding.

    4) And also I want to display values of respective bar on top of them.. Plz guide me.


    HTH,
    Uwe

Similar Threads

  1. Replies: 2
    Last Post: 17th May 2017, 05:31
  2. QwtPlotMultiBarChart not equal width
    By nanthiran_2005 in forum Qwt
    Replies: 6
    Last Post: 27th June 2014, 12:39
  3. QwtPlotMultiBarChart with raw data
    By Momergil in forum Qwt
    Replies: 2
    Last Post: 14th May 2014, 17:27
  4. Stacked Curves - QwtPlotMultiBarChart
    By GG2013 in forum Qwt
    Replies: 2
    Last Post: 13th August 2013, 02:58
  5. Replies: 1
    Last Post: 26th July 2009, 15:08

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.