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 { get; set; }
}
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.