Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Legend FormatString has no effect
posted

Here's my sample code, called after InitializeComponent.  It seems to have no effect, as the legend text is always the series name.  How do I change the legend text?  Is this a bug?  Any workaround?  It's a line graph only. 

            Hashtable labelHash = new Hashtable();
            labelHash.Add("CURRENTVALUE", new LineChartCurrentValueRenderer(this));
            mChart.LabelHash = labelHash;
            mChart.Legend.FormatString = "<CURRENTVALUE>";

Parents
No Data
Reply
  • 25
    posted

    I realise this is an old thread, but I've hit the same problem, and a solution here would have saved a lot of time!

    It appears to be a bug. If the chart is bound to a series collection, then FormatString doesn't work for the legend. It's OK if you bind to a datasource.

    Additionally, the ChartDrawitem event does get called OK for the legend labels, but there's no indication of what they refer to (no series, column etc. fields are completed) Thus it's hard to know you're dealing with a label, if you want to attempt do some reformatting in that draw event.

Children
No Data