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.
Unfortunately, activation email could not send to your email. Please try again.

Assign dynamic data to series

Thread ID:

Created:

Updated:

Platform:

Replies:

129977 Apr 13,2017 01:52 AM Apr 20,2017 01:40 PM Xamarin.Forms 6
loading
Tags: SfChart
Devesh
Asked On April 13, 2017 01:52 AM

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

Devesh
Replied On April 14, 2017 05:05 AM

Instead of 

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

Try this, 

Series.ItemsSource = "Your data list";

It's working for me.

Parthiban Sundaram [Syncfusion]
Replied On April 14, 2017 08:22 AM

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
 


Devesh
Replied On April 14, 2017 08:31 AM

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.

Divya Venkatesan [Syncfusion]
Replied On April 18, 2017 01:36 PM

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

Devesh
Replied On April 18, 2017 11:51 PM

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.

Divya Venkatesan [Syncfusion]
Replied On April 20, 2017 01:40 PM

Hi Devesh,

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

Regards,
Divya Venkatesan


CONFIRMATION

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.

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.

;