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

Message ListMessage List     Post MessagePost Message

  SVG rendering area
Posted by Marko on May-27-2015 19:54
Attachments:
Hi
I'm trying to render charts in SVG but I'm having problems with the rendering area, see attachment for FF, Chrome and IE; image is displayed partially, only left top corner. Similar results for:

<div style="width:700px;height:800px">
  <img src="http://localhost/chartdirector/phpdemo/simplepie.php"/>
</div>


How to display the whole chart?

Thanks!

<?php
require_once("../lib/phpchartdir.php");

# The data for the pie chart
$data = array(25, 18, 15, 12, 8, 30, 35);

# The labels for the pie chart
$labels = array("Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities",
    "Production");

# Create a PieChart object of size 360 x 300 pixels
$c = new PieChart(300, 300);
$c->getDrawArea()->enableVectorOutput();

# Set the center of the pie at (180, 140) and the radius to 100 pixels
$c->setPieSize(180, 140, 100);

# Set the pie data and the pie labels
$c->setData($data, $labels);

# Output the chart
header("Content-type: image/svg+xml");
print($c->makeChart2(SVG));
?>
chartdirector_phpdemo_simplepie.php.png

  Re: SVG rendering area
Posted by Peter Kwan on May-28-2015 00:25
Hi Marko,

Please use:

$c->enableVectorOutput();

not "$c->getDrawArea()->enableVectorOutput();". It is because the enableVectorOutput
must be the first method that is called after creating the chart. In your code, it calls
getDrawArea first, then enableVectorOutput, and it is too late. The
DrawArea.enableVectorOutput is used when you are creating the DrawArea object directly
without using an XYChart or BaseChart object. If you use an XYChart object, you should
call the enableVectorOutput of the chart object instead.

Hope this can help.

Regards
Peter Kwan