Page 1 of 1

Tlineseries legen fonts

Posted: Sun Apr 01, 2012 9:35 pm
by 10546846
hi, I have a chart with half a dozen line series, each series gets an entry in the chart legend, the entry each being the series name, followed by some stats values like min/max/mean. I'd like to alter the series name and font as shown in legend at run time depending on certain conditions. I have check box in legend for each series. If the data in a series is found not to meet certain conditions, I want to add asterisks to the legen text, and make the legend for that series only have bold font and maybe a coloured background.
I can alter the text with myseries[x].Title:='** BAD **'; but need also something like myseries[x].title.font.color:=clred etc.

any help much appreciated
cheers
Sean

Re: Tlineseries legen fonts

Posted: Tue Apr 03, 2012 10:13 am
by yeray
Hi Sean,

You can use the OnGetLegendText event to modify the LegendText. However, you can't modify the items font there.
So I'd use OnAfterDraw event to manually draw the customized text over the default legend. You could still set the texts at OnGetLegendText, and set the font color to the same as the legend background, as a simple way to force the legend to have the correct width.