Articles in this section
Category / Section

How to SeriesRendered event and SfBusyIndicator in Xamarin Chart?

2 mins read

You can use the SeriesRendered event and SfBusyIndicator to know whether the chart series in Xamarin Charts is rendered when loading the large number of data points in SfChart.
The following code sample demonstrates how to use the SeriesRendered event with the SfBusyIndicator. You can download the complete sample from the following link.

 

Xaml

<StackLayout>
          …….
        <Button Text="Update ItemsSource" Clicked="Button_Clicked"/>
        <Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
            
            <chart:SfChart SeriesRendered="SfChart_SeriesRendered">
                 ………                
                <chart:SfChart.Series>
                    <chart:FastLineSeries x:Name="fastline" XBindingPath="XValue" 
                                         YBindingPath="YValue"/>
                </chart:SfChart.Series>
            </chart:SfChart>
 
            <syncfusion:SfBusyIndicator x:Name="busyindicator" AnimationType="SingleCircle"
                     Title="Loading..." ViewBoxWidth="50" ViewBoxHeight="50" TextColor="Blue"  />     
      </Grid>
</StackLayout>

 

C#

private void Button_Clicked(object sender, EventArgs e)
{
      busyindicator.IsBusy = true;
 
      Task.Run(async () =>
      {
           await UpdateItemsSource();
      });
}
 
private async Task UpdateItemsSource()
{
      Task.Delay(300).Wait();
 
      Device.BeginInvokeOnMainThread(() =>
      {
           fastline.ItemsSource = viewmodel.GenerateData();
      });
}
 
private void SfChart_SeriesRendered(object sender, EventArgs e)
{
      busyindicator.IsBusy = false;
}

Output

SeriesRendered event in Xamarin.Forms Chart.



 

Conclusion

I hope you enjoyed learning how to SeriesRendered event and SfBusyIndicator in Xamarin Chart.

You can refer to our Xamarin. Forms Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin. Forms Charts example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied