Skip to content

Commit 54ce6c4

Browse files
committed
added additional content
1 parent ac37e08 commit 54ce6c4

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed

README.md

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,63 @@
22

33
The [.NET MAUI Cartesian Chart](https://help.syncfusion.com/maui/cartesian-charts/getting-started) will animate seamlessly in two ways: when you first load the chart or when you redraw it after modifying the data points. This section provides insights into both methods of animating the chart control.
44

5-
* We can smoothly animate the chart at loading by setting the [EnableAnimation](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html#Syncfusion_Maui_Charts_ChartSeries_EnableAnimation) property to True.
6-
* The SfCartesianChart provides seamless animation when dynamically changing data points.
5+
**Steps for Animating a Chart Upon Loading**
76

8-
The following demo visualizes how to animate the [.NET MAUI Cartesian Chart](https://www.syncfusion.com/maui-controls/maui-cartesian-charts).
7+
We can smoothly animate the chart at loading by setting the [EnableAnimation](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html#Syncfusion_Maui_Charts_ChartSeries_EnableAnimation) property to `True`.
8+
9+
```xml
10+
<chart:SfCartesianChart>
11+
. . .
12+
13+
<chart:ColumnSeries x:Name="series" ItemsSource="{Binding Data1}" XBindingPath="Month" YBindingPath="Value" EnableAnimation="True">
14+
</chart:ColumnSeries>
15+
16+
</chart:SfCartesianChart>
17+
```
18+
19+
**Steps for Dynamically Animating the Chart**
20+
The [SfCartesianChart](https://help.syncfusion.com/maui/cartesian-charts/getting-started) provides seamless animation when dynamically changing data points. Follow these steps to achieve dynamic animation in the .NET MAUI Cartesian Chart:
21+
22+
**Step 1:** Initialize and arrange the grid layout according to the desired view.
23+
24+
```xml
25+
<Grid>
26+
<Grid.RowDefinitions>
27+
<RowDefinition Height="50"/>
28+
<RowDefinition Height="*"/>
29+
</Grid.RowDefinitions>
30+
</Grid>
31+
```
32+
33+
**Step 2:** Configure the Syncfusion .NET MAUI SfCartesianChart control using this [documentation](https://help.syncfusion.com/maui/cartesian-charts/getting-started) and enable series animation.
34+
35+
**Step 3:** Add the button to the layout.
36+
37+
```xml
38+
<Grid>
39+
40+
<Button Grid.Row="0" Text="Add Data Point" Clicked="Animation_Clicked"/>
41+
42+
<chart:SfCartesianChart Grid.Row="1">
43+
. . .
44+
45+
<chart:ColumnSeries x:Name="series" ItemsSource="{Binding Data1}" XBindingPath="Month" YBindingPath="Value" EnableAnimation="True"/>
46+
47+
</chart:SfCartesianChart>
48+
49+
</Grid>
50+
```
51+
52+
**Step 4:** Change the ItemsSource collection in the button-clicked event.
53+
54+
```csharp
55+
private void Animation_Clicked(object sender, EventArgs e)
56+
{
57+
series.ItemsSource = viewModel.Data2;
58+
}
59+
```
60+
61+
**Output:**
962
![After](https://github.com/SyncfusionExamples/How-to-create-an-animated-chart-using-SfCartesianChart-in-.NET-MAUI/assets/103025761/b6573fc8-e200-4190-bbc2-4caff832e9a3)
1063

1164
## Troubleshooting

0 commit comments

Comments
 (0)