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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Series at Runtime

Thread ID:





146706 Aug 14,2019 08:36 PM UTC Aug 19,2019 01:12 PM UTC Xamarin.Forms 3
Tags: SfChart
Ramon Farizel
Asked On August 14, 2019 08:36 PM UTC

I'm trying build a Sfchart with Series generated at Runtime, could give me some sample?

Saravanan Madheswaran [Syncfusion]
Replied On August 15, 2019 09:50 AM UTC

Hi Ramon, 
We have prepared sample to achieve your requirement that will be downloaded from below link. 
In that sample we have updated the series dynamically on button click and we modified the series data collection at every half second.  
Please refer the below link, if you try to update existing data point in the series.  
We hope the above information will help you. 

Ramon Farizel
Replied On August 16, 2019 04:20 PM UTC

Hello Saravanan,

Thanks for attention, but this solution doesn't resolved my issue completly.

If i just follow this sample, my chart will be always with 2 Series. In my case I would like to generate at Runtime the quantity of series in my SFChart too. 

Rachel A [Syncfusion]
Replied On August 19, 2019 01:12 PM UTC

Hi Ramon, 
You can achieve this requirement by adding series to ChartSeriesCollection and bind it to series property of chart. Please refer the below code. 
<Button Text="Add Series Collection" Clicked="Button_Clicked" /> 
<chart:SfChart x:Name="chart" Series="{Binding ChartseriesCollection}" /> 
private void Button_Clicked(object sender, EventArgs e) 
    for(int i = 0; i < 5; i++) 
private void GenerateSeries() 
   var random = new Random(); 
   var data = new ObservableCollection<ChartDataModel>(); 
   for (int i = 1; i < 5; i++) 
      data.Add(new ChartDataModel(i, random.Next(0, 80))); 
   viewModel.ChartseriesCollection.Add(SetupSeries(new LineSeries(), data)); 
private XyDataSeries SetupSeries(XyDataSeries series, IEnumerable itemSource) 
   series.ItemsSource = itemSource; 
   series.XBindingPath = "XValue"; 
   series.YBindingPath = "YValue"; 
   return series; 
We have prepared sample for your reference, and it can be downloaded from the below link: 
Please refer the KB for more details  


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