An open API service indexing awesome lists of open source software.

https://github.com/syncfusionexamples/how-to-collapse-the-visibility-of-specific-data-label-in-.net-maui-cartesian-chart

This article in the Syncfusion Knowledge Base explains how to collapse the visibility of specific data label in .NET MAUI Cartesian chart
https://github.com/syncfusionexamples/how-to-collapse-the-visibility-of-specific-data-label-in-.net-maui-cartesian-chart

charting-library charts column-chart data-label data-label-customization data-label-visibility data-visualization hide-data-label maui-charts

Last synced: about 2 months ago
JSON representation

This article in the Syncfusion Knowledge Base explains how to collapse the visibility of specific data label in .NET MAUI Cartesian chart

Awesome Lists containing this project

README

        

# How-to-collapse-the-visibility-of-specific-data-label-in-.NET-MAUI-Cartesian-chart
This article in the Syncfusion Knowledge Base explains how to collapse the visibility of specific data label in .NET MAUI Cartesian chart

Collapsing the visibility of specific data labels in [Cartesian charts](https://www.syncfusion.com/maui-controls/maui-cartesian-charts) can be a useful way to improve your visualisation and focus on the most important data points.
This article will explain the step to hide or collapse specific data labels in a Cartesian chart.

**Step 1:** Define a data label template for the series.

**[XAML]**
```







```
**Step 2:** Create a value to visibility converter to control the visibility of the data label based on the Y-value. For example, in the following converter, we have collapsed the visibility of the data label for values less than 50.

**[C#]**
```
public class VisibilityConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (!(value is double labelValue))
return null;

if (labelValue < 50)
return false;
return true;
}

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value;
}
}
```
**Step 3:** To control the visibility, bind the converter to the DataTemplate layout IsVisible property

**[XAML]**
```










```
**Step 4:** Set the defined DataTemplate to the [LabelTemplate](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html#Syncfusion_Maui_Charts_ChartSeries_LabelTemplate) property of [ColumnSeries](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ColumnSeries.html).

**[XAML]**
```

. . .







```
**Output**
![collapse_the_visibility_of_specific_data_label.png](https://support.syncfusion.com/kb/agent/attachment/article/15889/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjIyMTg5Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.cBwXqvUHvRWwf42SCvO5NwWNU1mr5LcsR4kVAR375v8)