How to control chart's legend behavior?
Posted: Wed Aug 12, 2009 3:53 pm
Hi,
If I understand correctly, legend behavior is controlled through its LegendStyle property. By default it is set to lsAuto, which makes it behave differently when there is a single data series and multiple data series.
As expected, when there are multiple data series, the legend uses lsSeries style and displays each series' title (or name if title is not set).
When there is a single data series, the legend uses lsValues style and displays points/values from the data series.
What I would like to display in case of a single data series is not points/values but their corresponding axis labels. (I'm setting these labels myself, for each point/value.) Is there a way to do that?
So far I have tried to access Legendtems collection and manually override each item text (calling item's SetText method) but that did not work (I get an empty legend).
Btw, I'm manipulating the chart externally and I can't use the callbacks such as OnGetLegendText mentioned in a few places in this forum.
Thanks in advance for help!
If I understand correctly, legend behavior is controlled through its LegendStyle property. By default it is set to lsAuto, which makes it behave differently when there is a single data series and multiple data series.
As expected, when there are multiple data series, the legend uses lsSeries style and displays each series' title (or name if title is not set).
When there is a single data series, the legend uses lsValues style and displays points/values from the data series.
What I would like to display in case of a single data series is not points/values but their corresponding axis labels. (I'm setting these labels myself, for each point/value.) Is there a way to do that?
So far I have tried to access Legendtems collection and manually override each item text (calling item's SetText method) but that did not work (I get an empty legend).
Btw, I'm manipulating the chart externally and I can't use the callbacks such as OnGetLegendText mentioned in a few places in this forum.
Thanks in advance for help!