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

Assign dynamic data to series

Hi,

I am trying to assign dynamic data to series which is coming from some database. But it seems, there is some issue which i am not able to figure it out.
Here is my code. Please look into it.

for (var i = 0; i < serieslist.Count; i++) {
     List<SeriesAttributeModel> ChartData = new List<SeriesAttributeModel>();
     ChartData = (serieslist[i] as SeriesModel).SeriesData;
     ColumnSeries Series = new ColumnSeries();
     Series.SetBinding(ChartSeries.ItemsSourceProperty, "ChartData");
     Series.XBindingPath = "Month";
     Series.YBindingPath = "Count";
     Series.EnableAnimation = true;
     Series.AnimationDuration = 1.0;
     Series.EnableTooltip = true;
     Series.EnableDataPointSelection = true;
     Series.DataMarker = new ChartDataMarker();
     Series.LegendIcon = ChartLegendIcon.Circle;
     Series.Label = "ABC";
}

Note: serieslist - it's a list of all series with chart data.

I am getting a blank screen with primary and secondary axis only. You can check it in attachement.
Please let me know, what is the issue ?

Also i want to know, does SfChart supports annotations ?

Attachment: Capture_affaa34b.zip

6 Replies

DE Devesh April 14, 2017 09:05 AM UTC

Instead of 

Series.SetBinding(ChartSeries.ItemsSourceProperty, "ChartData");

Try this, 

Series.ItemsSource = "Your data list";

It's working for me.


PS Parthiban Sundaram Syncfusion Team April 14, 2017 12:22 PM UTC

Hi Devesh,

Query 1 :“Issue in dynamic data to series

You can resolve this issue by replacing following code snippet 
  
List<SeriesAttributeModel> ChartData {get; set;} 

ChartData = new List<SeriesAttributeModel>();
 
 

 Query 2 :“Annotations in SfChart

Currently, we don’t have support for annotation in SfChart. We will consider this as future request and it will be available in any of our upcoming release.

https://www.syncfusion.com/support/directtrac/features/XAMARIN-206  

Please let us know, if you need further assistance on this.

Regards,
Parthiban S
 



DE Devesh replied to Parthiban Sundaram April 14, 2017 12:31 PM UTC

Hi Devesh,

Query 1 :“Issue in dynamic data to series

You can resolve this issue by replacing following code snippet 
  
List<SeriesAttributeModel> ChartData {get; set;} 

ChartData = new List<SeriesAttributeModel>();
 
 

 Query 2 :“Annotations in SfChart

Currently, we don’t have support for annotation in SfChart. We will consider this as future request and it will be available in any of our upcoming release.

https://www.syncfusion.com/support/directtrac/features/XAMARIN-206  

Please let us know, if you need further assistance on this.

Regards,
Parthiban S
 


Thanks for your reply. But for the query 1, i have already posted one solution.
The solution which you have given, i have already done that, but it's not working. Please check my code which i have shared.


DV Divya Venkatesan Syncfusion Team April 18, 2017 05:36 PM UTC

Hi Devesh,

In your previous code snippet, you have declared ChartData as field instead of property. We have modified the sample for this and attached for your reference.

Please check and let us know if your issue is different from this.

Sample: http://www.syncfusion.com/downloads/support/forum/129977/ze/ChartSample-2063241436

Regards,
Divya Venkatesan


DE Devesh April 19, 2017 03:51 AM UTC

Hi Divya,

I have already tried with the new approach which you have mentioned. But when i assign ChartData with dynamic data, currently it's static, it's shows a blank chart.
Anyways, the solution which i have provided, it's working with dynamic data also.

Many thanks for your support.


DV Divya Venkatesan Syncfusion Team April 20, 2017 05:40 PM UTC

Hi Devesh,

Thank for the update. Please get back to us if need further assistance.

Regards,
Divya Venkatesan


Loader.
Live Chat Icon For mobile
Up arrow icon