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

adding series to the chart from server side code.

I have a line chart that I want to populate with data from a database. The problem I'm having is the amount of series I need changes depending on the data that the user wants from the database. I can't find anything in the documentaion about this. Maybe I am looking in the wrong place. Or going about this the wrong way. Any help would be greatly appreciated. 

3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team March 13, 2019 11:47 AM UTC

Hi Gideon, 
Greetings from Syncfusion. 
We have analysed your query. We have prepared a sample based on your requirement. In that we have created multiple list of data in server side and store all collections in ViewBag. Then dynamically add series in view page based on data length. Please find below snippet, 
Code Snippet: 
    var count = Enumerable.Count(ViewBag.Items); 
     .Series(series => 
            for(var i=0; i< count; i++) { 
public ActionResult ChartFeatures() 
List<List<DoubleAxisData>> data = new List<List<DoubleAxisData>>(); 
//Other configurations 
ViewBag.Items = data; 
return View(); 
Hope this helps. 

GK Gideon Keys March 13, 2019 08:05 PM UTC

Thank you. That worked great!

DD Dharanidharan Dharmasivam Syncfusion Team March 14, 2019 06:49 AM UTC

Hi Gideon, 
Most welcome. Kindly get in touch with us, if you require further assistance. We are always happy in assisting you. 

Live Chat Icon For mobile
Up arrow icon