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
415
Custom Marker Format {Value}%
posted

I would like to make the values show up as percents in the pie chart. I can either set it to the value or figure out what percent ahead of time but i want to have the % sign....

 

Is this possible?

  • 28496
    Verified Answer
    Offline posted

    here's some code that will put the % values on there for you...

            private void XamWebChart_Loaded(object sender, RoutedEventArgs e)
            {
                XamWebChart theChart = (XamWebChart)sender;
                double total = 0.0;
                foreach (DataPoint dp in theChart.Series[0].DataPoints)
                {
                    total += dp.Value;
                }
                foreach (DataPoint dp in theChart.Series[0].DataPoints)
                {
                    dp.Marker = new Marker() { Format = dp.Value / total * 100.0 + "%" };
                }
            }