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

smart labels config

Hi, I develop cross-platform App using sfchart and sometimes I get zero (0) value data (of course from my db) to bind into pie chart. after activate smartlabel (EnableSmartLabels="true" ), all data, including zero value  also appear on chart. My question is, any suggestion to hide zero value in label?
(I attached the picture of chart)

Thank you

3 Replies

MK Muneesh Kumar G Syncfusion Team September 2, 2019 10:18 AM UTC

Hi Ronanobelta Syakura, 
Greetings from Syncfusion. 
Query: How to hide the 0 value from DataMarker Label. 
Your requirement can be achieved by excluding the zero value from the bound ItemsSource of PieSeries using Converter.  
Please have code examples, 
Chart XAML: 
<chart:PieSeries x:Name="pieSeries"
                            ItemsSource="{Binding Data,Converter={StaticResource ExcludeZeroConverter}}"
                             EnableSmartLabels = "true" 
                        <chart:ChartDataMarker ShowLabel="True"/>
 public class ExcludeZeroConverter : IValueConverter
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            var collection = value as List<Person>;
            return collection != null ? collection.Where(x => x.Height != 0).ToList() : value;

Here, Height is the YBindingPath property.  
Please download the attached sample from below link 
Muneesh Kumar G 

RS Ronanobelta Syakura September 6, 2019 12:44 AM UTC

Works as expected.  Thank you for your help

MK Muneesh Kumar G Syncfusion Team September 6, 2019 05:11 AM UTC

Hi Ronanobelta Syakura,  
Thanks for the update. 
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
Muneesh Kumar G. 

Live Chat Icon For mobile
Up arrow icon