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

Message ListMessage List     Post MessagePost Message

  Resize Chart in respect to the legend-box?
Posted by Chris on Jan-26-2011 19:29
Attachments:
Hi guys,

I got some charts with dynamically generated content, so it is impossible for me to know
in advance how many datasets are added via "$layer->addDataSet()" and the legend can
quickly become larger than the chart-area, resulting in a cut-off legend-box.
Is there any way to instruct ChartDirector to compute the size of the legend-box and then
resize the chart in order to prevent legend entries from not being shown or being cut off?

Example is attached.

Thank you,
Chris
legende_zu_gross.png

  Re: Resize Chart in respect to the legend-box?
Posted by System Administrator on Jan-26-2011 22:03
Hi Chris,

May be you can try something like (using ChartDirector Ver 5):

... create chart and add all data to the chart ....

$legendBox = $c->layoutLegend();
$c->setSize($c->getWidth(), $legendBox->getHeight() + 400);

Hope this can help.

Regards
Peter Kwan

  Re: Resize Chart in respect to the legend-box?
Posted by Chris on Jan-31-2011 23:19
Other possibility would be (since I embedded the charts into a website) to query the chart
something like "give me the colors and assigned legend item" so I could build a legend
myself using HTML. Does anyone know a method for it?

  Re: Resize Chart in respect to the legend-box?
Posted by Peter Kwan on Feb-01-2011 01:50
Hi Chris,

Currently, the ChartDirector API is designed only to provide certain information created by ChartDirector (such as the legend box size). It does to provide information that your code already knows, such as the colors (as the colors are passed by your code to ChartDirector, so your code already knows the colors), and the data set names.

For your case, if you need to retrieve the colors, you would need to query your code for the colors and the data set names.

Regards
Peter Kwan