ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Switching from png to svg output
Posted by Marelli on Jul-26-2013 05:42
I have developed and unit tested 5 charts using Perl with png output.

I made these source code changes to switch them to svg output:

my $Chart = new XYChart(850, 600);
new>>>> $Chart->enableVectorOutput();
$Chart->setBackground ( 0xFFFFFF, -1, 0x000000 );

...code for format the chart...then at the end:

delete>>> $Chart->makeChart('my_png_chart.png')
new>>>>  $Chart->getDrawArea->outSVG('my_svg_chart.svg')

I am getting "blank" svg files output containing only a <rect.../> element for the 850 by 600 drawing area.

Is there something else I need to change to get svg output?

Marelli

  Re: Switching from png to svg output
Posted by Marelli on Jul-26-2013 07:24
I have determined from a helpful associate that this will produce the svg output:

$Chart->makeChart('my_svg_chart.svg')

I am still puzzled as to why this code did not produce the same output:

$Chart->getDrawArea->outSVG('my_svg_chart.svg')

Could someone please explain why it didn't?

Marelli

  Re: Switching from png to svg output
Posted by Peter Kwan on Jul-26-2013 17:46
Hi Marelli,

The BaseChart.getDrawArea obtains the DrawArea without drawing the chart. The intention of this API is to allow you to use the DrawArea obtain to draw custom shapes on the background before the chart is drawn. Typical usage is:

my $d = $c->getDrawArea();

... The chart has not yet been drawn, so you may use $d to draw custom shapes
... on the background

#draw chart as usual
$c->makeChart(......);

The BaseChart.makeChart3 obtains the DrawArea after the chart is drawn. It allows you to add things to the chart. So "$Chart->makeChart('my_svg_chart.svg')" should be equivalent to "$Chart->makeChart3()->outSVG('my_svg_chart.svg')".

Hope this can help.

Regards
Peter Kwan