Chart events never called = chart1.DataBound += (object sender3, ChartDataBoundEventArgs e3) =>

2 posts, 0 answers
  1. alpascual
    alpascual avatar
    3 posts
    Member since:
    Feb 2007

    Posted 03 May 2010 Link to this post

    Trying to override the Legend Items that are created automatically, just need to change the labels from Item 0, Item 1 … to my own labels, I don’t want to do it manually, if I do so I lose the colors that automatically you guys assigned. Now I have tried to subscribe to events like

    chart1.DataBound += (object sender3, ChartDataBoundEventArgs e3) =>

    without any luck as I just want to access the collection of Items Labels after then have been created to change it from Item 0 to my own writing. What’s the event that I can subscribe that will work?

  2. alpascual
    alpascual avatar
    3 posts
    Member since:
    Feb 2007

    Posted 03 May 2010 Link to this post

    Found the solution and the event that will be called, however this works like the ASP.NET Binding, I should be able to access to the Legend Item Collection after was bound instead of having to get call at every item at binding time and override the name, the performance isn't that good.

    chart1.ItemDataBound += (

     

    object sender3, ChartItemDataBoundEventArgs e3) =>

     

    {

    e3.DataPoint.LegendLabel = GetMyName(e3.DataPoint);

     

    };

Back to Top