PDA

View Full Version : export and printing qwt plot



giusepped
15th December 2008, 03:52
I just followed the examples in qwt disto.
Thr pinting is quite good.
However, when I try to export an svg file, I get also negative values inside the figures.

I mean: my plot data have negative values on the y axis, but when I plot, I fix the value of the axis to be positive. So on screen, I get only positive values.

The ps printing is ok. When I export the svg file, I get also the negative values, like in this figure.

giusepped
15th December 2008, 04:31
I think there is a bug, which a summarize here

1) If I use alignScale(), by inserting A QFrame::Box| QFrame::Plain to the canvas(), the on screen plots look good, but both the svg and the ps/pdf will lack of the canvas box. It seems that there is an overlapping...

Any reply accepted.

Uwe
15th December 2008, 08:20
If I use alignScale(), by inserting A QFrame::Box| QFrame::Plain to the canvas(),
What is alignScale() and what has the frame around the canvas to do with it ?


... the on screen plots look good, but both the svg and the ps/pdf will lack of the canvas box.

QwtPlotPrintFilter::PrintFrameWithScales ?

Uwe

giusepped
16th December 2008, 08:17
Thank you very much for your reply.
alignScales() is the function in the bode example.
Withouth that I cannot obtain a bounding box around the plot.
Anyway, now I changed the print function (taken from the same example).
I forced the option to be as follows:


QwtPlotPrintFilter filter;
// if ( printer.colorMode() == QPrinter::GrayScale )
{
int options = QwtPlotPrintFilter::PrintAll;
options &= ~QwtPlotPrintFilter::PrintBackground;
options |= QwtPlotPrintFilter::PrintFrameWithScales;
filter.setOptions(options);
}

print(printer,filter);

and all works. Why the option is set only in GrayScale?
But the real problem is the export to SVG.
I took the same code from the bode example. And I get the figure attached.
I think the problem is that I have also negative values. Anyway, I fixed the range of the y axis to be 0-80. Why in the export I get also the negative values?

giusepped
17th December 2008, 04:22
I really will appreciate any suggestion to this problem.
I cannot understand why the svg file is different from my plot on screen.
Regards

Uwe
17th December 2008, 07:39
Why the option is set only in GrayScale?Without colors it is often better not to print the canvas background ( or simply to save toner/ink ). If you don't have a canvas background you need a bounding box instead. That's all.


But the real problem is the export to SVG.
In your pictures the curves are painted outside of the canvas, what should never happen.

Did you overload any methods of Qwt classes and what do you mean by "fixing" negative values on the y axis in detail. Guess you do something illegal there.

Uwe

giusepped
17th December 2008, 08:04
Without colors it is often better not to print the canvas background ( or simply to save toner/ink ). If you don't have a canvas background you need a bounding box instead. That's all.


In your pictures the curves are painted outside of the canvas, what should never happen.

Did you overload any methods of Qwt classes and what do you mean by "fixing" negative values on the y axis in detail. Guess you do something illegal there.

Uwe

Thank you again.
I did not overloaded any method. I just copied the code of the bode example (the exportSVG method).
In my constructo I have


setAxisScale(QwtPlot::yLeft,0,80);

which "fixes" the data to be positive on y axis.
However, when I export with the code I get such picture (which is different from what is painted on screen).
The data contains both positive and negative values, but only positive are painted on screen. Could this fact have some impact on exporting?