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. Image for the cookie policy date

Can we show zero entry (separator) in PieChart?

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

3 Replies

HM Hemalatha Marikumar Syncfusion Team November 12, 2019 05:17 AM

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. 



JE Jegan November 12, 2019 09:28 PM

Hi Hema,

Thanks for your update :)

Regards,
Jegan Raj M


HM Hemalatha Marikumar Syncfusion Team November 12, 2019 11:00 PM

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


Loader.
Live Chat Icon For mobile
Up arrow icon