|
Bug: DrawArea::setOutputOptions |
Posted by Chris Tonks on Oct-19-2016 19:09 |
|
Hi Peter, I hope you're well.
I've spotted what I think is a bug in SVG output. I've recently updated to 6.0 (trial - I'll get the licence soon!) and am running the PHP version.
I have one image that I output the normal way using BaseChart::makeChart2(SVG). By calling BaseChart::setOutputOptions('nodoctype;width;height') before that I'm able to have the SVG exported with the width and height specified and the DOCTYPE declaration removed. That works perfectly.
I have another image that's combined from several charts, ultimately output with DrawArea::outSVG2(). I want to apply the same options as my first image, so I call DrawArea::setOutputOptions('nodoctype;width;height'). This has no effect on the resulting SVG. To get it to work I need to call outSVG2 with the options directly: DrawArea::outSVG2('nodoctype;width;height'). I was hesitant to do this because the documentation claims that's deprecated.
Would you expect DrawArea::setOutputOptions to work in this scenario or was I right to use outSVG2 with the deprecated options parameter? |
Re: Bug: DrawArea::setOutputOptions |
Posted by Peter Kwan on Oct-20-2016 01:39 |
|
Hi Chris,
Thanks for informing us of this issue. We confirm that this is in fact a bug in ChartDirector. For DrawArea.outSVG2, the output options must be specified in the outSVG2 parameter, and any setOutputOption is ignored. This is contrary to the recommendation of the documentation.
For the moment, please simply set the options in outSVG2. We have no plan to stop supporting this parameter. Like other deprecated APIs, we will no longer update the documentation for this parameter, but this will probably continue to work.
Internally, the parameter in outSVG2 is simply forwarded to setOutputOptions. The bug is that in PHP, if the outSVG2 parameter is not provided, the default value will be used, which is an empty string. This causes setOutputOptions to be called with an empty string (which means no options), and this overwrites the previous setOutputOptions.
We will fix this problem in the next version of ChartDirector.
Regards
Peter Kwan |
|