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

Message ListMessage List     Post MessagePost Message

  Font size in a legend layout
Posted by phil1308 on Sep-12-2012 22:23
Hello, I'm using ChartDirector under myDBR reporting system.

I have a little problem while trying to change the font size in a chart legend with this code :

select 'dbr.chart.options', 'chartdirector', '$c->layoutLegend()->setBackground(0xEEEEEE,
0x000000); $c->layoutLegend()->setFontColor(0xaaaaaa); $c->layoutLegend()-
>setFontSize(10);';

Every functions work well (setBackground, setFontColor,...) but not setFontSize() : it
doesn't make any change in my legend font size !
Do you see why ?

Thank you for any answer.

  Re: Font size in a legend layout
Posted by Peter Kwan on Sep-12-2012 23:49
Hi phil1308,

Instead of layoutLegend, please use getLegend.

The function of layoutLegend is to layout the legend box. This method is typically use so that you can determine the legend box size. After calling layoutLegend, you can no longer perform anything that can change the legend box size, such as modifying the font size. But you can still change the legend box position and colors.

In contrast, the getLegend method just gets the legend box object without performing anything.

Actually, when you call addLegend, you can pass in a font size (as the fifth parameter). In this case, you may not need to call setFontSize in a separate line.

Hope this can help.

Regards
Peter Kwan

  Re: Font size in a legend layout
Posted by phil1308 on Sep-12-2012 23:57
Thank you very much !
It works fine !

My new source code is now :
select 'dbr.chart.options', 'chartdirector', '$legendBox = $c->getLegend(); $legendBox-
>setBackground(0xEEEEFF); $legendBox->setFontSize(12);';

Thanks again.