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

smart labels config

Thread ID:

Created:

Updated:

Platform:

Replies:

147057 Aug 30,2019 10:12 AM UTC Sep 6,2019 05:11 AM UTC Xamarin.Forms 3
loading
Tags: SfChart
Ronanobelta Syakura
Asked On August 30, 2019 10:12 AM UTC

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

Muneesh Kumar G [Syncfusion]
Replied On 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" 
                            XBindingPath="Name"
                            YBindingPath="Height">
                    <chart:PieSeries.DataMarker>
                        <chart:ChartDataMarker ShowLabel="True"/>
                    </chart:PieSeries.DataMarker>
                    </chart:PieSeries>
 
 
 
ExcludeZeroConverter: 
 
 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 
 
 
Thanks, 
Muneesh Kumar G 


Ronanobelta Syakura
Replied On September 6, 2019 12:44 AM UTC

Works as expected.  Thank you for your help

Muneesh Kumar G [Syncfusion]
Replied On 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. 
 
Thanks, 
Muneesh Kumar G. 


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