This is a migrated thread and some comments may be shown as answers.

[Solved] Representing a variable number of series

1 Answer 88 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christopher Ronak
Top achievements
Rank 1
Christopher Ronak asked on 08 May 2012, 05:32 PM
Hi,
I'd like to be able to create a chart that can handle a non predetermined number of series. My model and controller are fine, I'm just not sure how I'd represent that in the view. All the examples I've seen show all the series' in the chart as hard-coded/pre-defined. 

Thanks for any help!

Chris

1 Answer, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 11 May 2012, 02:01 PM
Hi Christopher Ronak,

Can you try to build your series with predefined fields(via ViewBag for example)?
Controller:

ViewBag.seriesFields = new List<string>() { "RepSales", "TotalSales" };
View:
...
.Series(series => {
    foreach (string field in ViewBag.seriesFields)
    {
        series.Area(field);
    }
})
...
Regards,
Hristo Germanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Chart
Asked by
Christopher Ronak
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Share this question
or