We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to return the percentages of the total for each data points in the series and bind the data labels to this

Platform: WPF |
Control: PivotGridControl |
Published Date: November 24, 2014 |
Last Revised Date: November 26, 2014
Tags: general, wpf

We can display the percentage of each data points by using the DataTemplate. The Following code snippet explains the same.

XAML

We can bind the Text of the Data Template with a Converter class. In the above code snippet “labelconverter” is the Converter class. The following is an example code snippet

C#

public class Labelconvertor : IValueConverter

{

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{

double a, b;

b = System.Convert.ToDouble(value);

a = (b / 3000000) * 100;

return String.Format("{0} %", a);

}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{

throw new NotImplementedException();

}

}

 

 

http://www.syncfusion.com/downloads/Support/DirectTrac/101773/clip_image001-955269359.png

Figure: Pivot Grid shows the percentages of total for each of data points

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon