2 Attachment(s)
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.
Re: Need space between bars in QwtPlotMultiBarChart
Quote:
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/
Quote:
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 ?
Quote:
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
Re: Need space between bars in QwtPlotMultiBarChart
Thank u, Uwe...
Quote:
Originally Posted by
Uwe
You probably need to overload drawSample or drawBar. Have a look at the implementation of QwtPlotMultiBarChart and you will find your way.
Will do this.
Quote:
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::DiscardCa nvasBackground, true);
renderer.setDiscardFlag(QwtPlotRenderer::DiscardCa nvasFrame, true);
renderer.setDiscardFlag(QwtPlotRenderer::DiscardBa ckground, true);
//renderer.setLayoutFlag(QwtPlotRenderer::FrameWithS cales, true);
QString strFileName = m_pPDFPage->m_strFileName;
renderer.renderDocument(pPlot, strFileName, plotRect.size(), 4);
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