Hi
I'm generating the graph dynamically based on loaded description and data.
The (simplified) code as follows:
Is there a better (dynamic) way to set chart type without having the if/switch block?
Besides Aggregate I have a lot of options to set for most (but not all) series. So I wouldn't need to copy the lines for every possible chart type. Is it possible in current solution to catch each series (created by e.g. .Area()) in a variable and conditionally set properties on it?
Would the current approach to build a "very dynamic" chart in a View recommended? Is it possible build it completely in an Action instead?
Yes, the question might be related to razor/htmlhelpers in general, still interested in recommended Kendo approach. Thanks.
Raido
I'm generating the graph dynamically based on loaded description and data.
The (simplified) code as follows:
<
div
class
=
"chart-wrapper"
>
@(Html.Kendo().Chart()
.Name("Chart1")
.Transitions(false)
.Title(d.graph_name)
.Series(series => {
foreach (www.Models.ChartDataItem s in d.chart_items)
{
if (s.type == "area") {
series.Area(s.name)
.Aggregate(ChartSeriesAggregate.Avg);
}
if (s.type == "line")
{
series.Line(s.name)
.Aggregate(ChartSeriesAggregate.Avg);
}
}
})
Besides Aggregate I have a lot of options to set for most (but not all) series. So I wouldn't need to copy the lines for every possible chart type. Is it possible in current solution to catch each series (created by e.g. .Area()) in a variable and conditionally set properties on it?
Would the current approach to build a "very dynamic" chart in a View recommended? Is it possible build it completely in an Action instead?
Yes, the question might be related to razor/htmlhelpers in general, still interested in recommended Kendo approach. Thanks.
Raido