Results 1 to 7 of 7

Thread: export and printing qwt plot

  1. #1
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default export and printing qwt plot

    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.
    Attached Images Attached Images

  2. #2
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: export and printing qwt plot

    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.

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

    Default Re: export and printing qwt plot

    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

  4. #4
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: export and printing qwt plot

    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:
    Qt Code:
    1. // if ( printer.colorMode() == QPrinter::GrayScale )
    2. {
    3. int options = QwtPlotPrintFilter::PrintAll;
    4. options &= ~QwtPlotPrintFilter::PrintBackground;
    5. options |= QwtPlotPrintFilter::PrintFrameWithScales;
    6. filter.setOptions(options);
    7. }
    8.  
    9. print(printer,filter);
    To copy to clipboard, switch view to plain text mode 
    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?
    Attached Images Attached Images

  5. #5
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: export and printing qwt plot

    I really will appreciate any suggestion to this problem.
    I cannot understand why the svg file is different from my plot on screen.
    Regards

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

    Default Re: export and printing qwt plot

    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

  7. #7
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: export and printing qwt plot

    Quote Originally Posted by Uwe View Post
    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
    Qt Code:
    1. setAxisScale(QwtPlot::yLeft,0,80);
    To copy to clipboard, switch view to plain text mode 
    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?

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.