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
330
Access selected wedge of pie chart on click
posted

Hi!

I have a requirement where when I click on the pie chart i want to add explode animation to the wedge that is clicked on. Can you please tell me how i can do that.

Thanks and regards,

Usha.

Parents
No Data
Reply
  • 28496
    Suggested Answer
    Offline posted

    here you go:

            private void XamWebChart_DataItemMouseLeftButtonDown(object sender, DataItemMouseEventArgs e)
            {
                FrameworkElement el = e.Element as FrameworkElement;
                if (el != null)
                {
                    Dictionary<Type, object> tags = el.Tag as Dictionary<Type, object>;
                    if (tags != null && tags.ContainsKey(typeof(DataPoint)))
                    {
                        DataPoint dP = tags[typeof(DataPoint)] as DataPoint;
                        dP.ChartParameters.Add(new ChartParameter(ChartParameterType.Exploded, true));
                        dP.ChartParameters.Add(new ChartParameter(ChartParameterType.ExplodedAnimation, new Animation()));
                    }
                }
            }

Children