Skip to content

Prepare UG Documentation for ListenPropertyChange Support .NET MAUI Charts #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion maui-toolkit-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@
<li><a href="/maui-toolkit/cartesian-charts/tooltip">Tooltip</a></li>
<li><a href="/maui-toolkit/cartesian-charts/trackball">Trackball</a></li>
<li><a href="/maui-toolkit/cartesian-charts/zooming-and-panning">Zooming and Panning</a></li>
<li><a href="/maui-toolkit/cartesian-charts/Performance">Performance</a></li>
<li><a href="/maui-toolkit/cartesian-charts/exporting">Exporting</a></li>
<li><a href="/maui-toolkit/cartesian-charts/localization">Localization</a></li>
<li><a href="/maui-toolkit/cartesian-charts/localization">Localization</a></li>
<li>
How to
<ul>
Expand All @@ -168,6 +169,7 @@
<li><a href="/maui-toolkit/cartesian-charts/Add-custom-labels">Add custom labels to the chart axis</a></li>
<li><a href="/maui-toolkit/cartesian-charts/Customize-each-chart-axis-label">Customize each chart axis label using the callback event</a></li>
<li><a href="/maui-toolkit/cartesian-charts/Get-the-data-point-collection-based-on-region">Get the data point collection based on region</a></li>
<li><a href="/maui-toolkit/cartesian-charts/Enable-ListenPropertyChange-In-Charts">Enable ListenPropertyChange in Charts</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -205,6 +207,7 @@
<li><a href="/maui-toolkit/circular-charts/Legend">Legend</a></li>
<li><a href="/maui-toolkit/circular-charts/selection">Selection</a></li>
<li><a href="/maui-toolkit/circular-charts/tooltip">Tooltip</a></li>
<li><a href="/maui-toolkit/circular-charts/Performance">Performance</a></li>
<li><a href="/maui-toolkit/circular-charts/exporting">Exporting</a></li>
</ul>
</li>
Expand Down Expand Up @@ -331,6 +334,7 @@
<li><a href="/maui-toolkit/polar-charts/DataLabels">Data Label</a></li>
<li><a href="/maui-toolkit/polar-charts/Legend">Legend</a></li>
<li><a href="/maui-toolkit/polar-charts/Tooltip">Tooltip</a></li>
<li><a href="/maui-toolkit/polar-charts/Performance">Performance</a></li>
<li><a href="/maui-toolkit/polar-charts/Exporting">Exporting</a></li>
</ul>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
layout: post
title: Enable ListenPropertyChange in .NET MAUI Charts | Syncfusion
description: Learn how ListenPropertyChange in Syncfusion® .NET MAUI Chart (SfCartesianChart) control enables real-time data updates.
platform: maui-toolkit
control: SfCartesianChart
documentation: ug
keywords: .net maui chart listenpropertychange, maui chart property change, real-time chart updates, maui chart dynamic updates, listen property change feature, maui chart real-time data, listen property change
---

# ListenPropertyChange in .NET MAUI Charts

The ListenPropertyChange property in .NET MAUI Charts allows the chart to update dynamically when the underlying data source properties change. This enables real-time dynamic and data visualization.

By leveraging INotifyPropertyChanged, the data points now automatically reflect changes, ensuring the chart remains in real time and responsive to data updates.

To enable property change notifications, your data model must implement the INotifyPropertyChanged interface, as shown in the code below:

**C#**

{% highlight C# %}

public class DataModel : INotifyPropertyChanged
{
private string category;
private double metric;

public string Category
{
get => category;
set
{
if (category != value)
{
category = value;
OnPropertyChanged(nameof(Category));
}
}
}

public double Metric
{
get => metric;
set
{
if (metric != value)
{
metric = value;
OnPropertyChanged(nameof(Metric));
}
}
}

public event PropertyChangedEventHandler? PropertyChanged;

protected void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

{% endhighlight %}

## Enabling ListenPropertyChange in Charts

When your data model implements INotifyPropertyChanged, you need to set the ListenPropertyChange property of the series to `true`, to make the chart listen to the property changes of your data object.

**XAML**

{% highlight xaml %}

<chart:SfCartesianChart>

. . .

<chart:LineSeries ItemsSource="{Binding DataSource}"
XBindingPath="Category"
YBindingPath="Metric"
ListenPropertyChange="True" />

. . .

</chart:SfCartesianChart>

{% endhighlight %}

By default, ListenPropertyChange is set to `false` to prevent unnecessary event registrations and potential performance overhead.

N> Enabling ListenPropertyChange registers the PropertyChanged event of every object in the data source. If your dataset contains a large number of data points, this may impact on the chart’s loading performance.

19 changes: 19 additions & 0 deletions maui-toolkit/Cartesian-Charts/Performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: post
title: Performance in .NET MAUI Charts | Syncfusion
description: Learn about Performance in Syncfusion® .NET MAUI Chart (SfCartesianChart), its elements and more details.
platform: maui-toolkit
control: SfCartesianChart
documentation: ug
---

# Performance in .NET MAUI Charts

* If your underlying data object implements INotifyPropertyChanged, you can enable the `ListenPropertyChange` property on the series to make the chart listen to the property changes of your data objects.

* However, enabling the ListenPropertyChange property registers the PropertyChanged event for every object in the data source.

* When dealing with a large number of data points, registering these events can slow down the chart's loading time.

* To optimize performance and avoid unnecessary event registration, the ListenPropertyChange property is set to `false`.

19 changes: 19 additions & 0 deletions maui-toolkit/Circular-Charts/Performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: post
title: Performance in .NET MAUI Charts | Syncfusion
description: Learn about Performance in Syncfusion® .NET MAUI Chart (SfCircularChart), its elements and more details.
platform: maui-toolkit
control: SfCircularChart
documentation: ug
---

# Performance in .NET MAUI Charts

* If your underlying data object implements INotifyPropertyChanged, you can enable the `ListenPropertyChange` property on the series to make the chart listen to the property changes of your data objects.

* However, enabling the ListenPropertyChange property registers the PropertyChanged event for every object in the data source.

* When dealing with a large number of data points, registering these events can slow down the chart's loading time.

* To optimize performance and avoid unnecessary event registration, the ListenPropertyChange property is set to `false`.

19 changes: 19 additions & 0 deletions maui-toolkit/Polar-Charts/Performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: post
title: Performance in .NET MAUI Charts | Syncfusion
description: Learn about Performance in Syncfusion® .NET MAUI Chart (SfPolarChart), its elements and more details.
platform: maui-toolkit
control: SfPolarChart
documentation: ug
---

# Performance in .NET MAUI Charts

* If your underlying data object implements INotifyPropertyChanged, you can enable the `ListenPropertyChange` property on the series to make the chart listen to the property changes of your data objects.

* However, enabling the ListenPropertyChange property registers the PropertyChanged event for every object in the data source.

* When dealing with a large number of data points, registering these events can slow down the chart's loading time.

* To optimize performance and avoid unnecessary event registration, the ListenPropertyChange property is set to `false`.