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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can we show zero entry (separator) in PieChart?

Thread ID:

Created:

Updated:

Platform:

Replies:

149019 Nov 12,2019 06:53 AM UTC Nov 13,2019 07:00 AM UTC UWP 3
loading
Tags: SfChart
Jegan
Asked On November 12, 2019 06:53 AM UTC

Hi Team,

I'm using Pie Chart, I need to show the zero entry (separator between start and end point) in chart. Can we do this in SfChart?



Regards,
Jegan Raj M

Hemalatha Marikumar [Syncfusion]
Replied On November 12, 2019 01:17 PM UTC

Hi Jegan, 
  
Greetings from Syncfusion. 
  
We have analyzed your requirement and we would like to inform you that in our SfChart we neglect the zero angle segments while rendering. So, if you want to show your zero-value segment, you have to change that value as 0.1 instead of 0 and set the Stroke as White in series as per the below code snippet. 
  
Code snippet 
  
<Grid.Resources> 
            <local:DecimalConverter x:Key="decimalConverter"/> 
        </Grid.Resources> 
        <syncfusion:SfChart x:Name="Chart" Margin="20" > 
  
            <syncfusion:PieSeries x:Name="series1" ItemsSource="{Binding Data}" 
                                  Stroke="White" XBindingPath="XValue" 
                                                   YBindingPath="YValue"> 
                <syncfusion:PieSeries.AdornmentsInfo> 
                    <syncfusion:ChartAdornmentInfo ShowLabel="True" Foreground="White"> 
                        <syncfusion:ChartAdornmentInfo.LabelTemplate> 
                            <DataTemplate> 
                                <TextBlock Text="{Binding Converter={StaticResource decimalConverter}}" Foreground="White"/> 
                            </DataTemplate> 
                        </syncfusion:ChartAdornmentInfo.LabelTemplate> 
                    </syncfusion:ChartAdornmentInfo> 
                </syncfusion:PieSeries.AdornmentsInfo> 
            </syncfusion:PieSeries> 
          
        </syncfusion:SfChart> 
  
  
  
  public class ViewModel 
    { 
        public ViewModel() 
        { 
            Data = new ObservableCollection<Model>(); 
            Data.Add(new Model(1, 100)); 
            Data.Add(new Model(2, 0.1)); 
        } 
  
        public ObservableCollection<Model> Data { getset; } 
    } 
  
    public class DecimalConverter : IValueConverter 
    { 
        public object Convert(object value, Type targetType, object parameter, string language) 
        { 
            return Math.Round(System.Convert.ToDouble(value), 0); 
        } 
  
        public object ConvertBack(object value, Type targetType, object parameter, string language) 
        { 
            return value; 
        } 
    } 
  
  
Here we have used converter to show Zero value for your requirement. 
  
Output: 
  
 
  
Please let us know if you have any other queries. 
 
Regards, 
Hemalatha M. 


Jegan
Replied On November 13, 2019 05:28 AM UTC

Hi Hema,

Thanks for your update :)

Regards,
Jegan Raj M

Hemalatha Marikumar [Syncfusion]
Replied On November 13, 2019 07:00 AM UTC

Hi Jegan, 
 
Thanks for your update. 
 
Please let us know if you have any other query. 
 
Regards, 
Hemalatha M. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

Live Chat Icon For mobile
Live Chat Icon