This question is locked. New answers and comments are not allowed.
I've been using the chart control in server binding mode for awhile, but now I have a need to use Ajax binding on a specific page.
In server binding, I bind to a complex type called a UIReport. A UIReport is a representation of an actual chart with a collection of UIDataSeries. The UIDataSeries types contain the chart type that should display the data, the data values for the series, and the series name, among other values.
In server binding mode, I've been using the following approach, because I need to choose the chart type at run time:
How should I approach this in Ajax binding? What value should I use in the "foreach" at the top of the Series configuration, if indeed this is supported at all? I've looked at the Ajax sample and it seems more straightforward.
My Ajax controller basically does something like this:
UIReport myreport = GetUIReport();
return new JSON(myreport);
Thanks for any pointers.
Chris
In server binding, I bind to a complex type called a UIReport. A UIReport is a representation of an actual chart with a collection of UIDataSeries. The UIDataSeries types contain the chart type that should display the data, the data values for the series, and the series name, among other values.
In server binding mode, I've been using the following approach, because I need to choose the chart type at run time:
.Series(series =>
{
foreach (var dataSeries in Model.Report.DataSeriesCollection)
{
switch (dataSeries.ChartType)
{
case ChartType.Area:
series.Area(dataSeries.Values).Name(dataSeries.Description);
break;
case ChartType.Bar:
series.Bar(dataSeries.Values).Name(dataSeries.Description);
break;
case ChartType.StackedBar:
series.Bar(dataSeries.Values).Name(dataSeries.Description).Stack(true);
break;
case ChartType.Column:
series.Column(dataSeries.Values).Name(dataSeries.Description);
break;
case ChartType.StackedColumn:
series.Column(dataSeries.Values).Name(dataSeries.Description).Stack(true);
break;
case ChartType.Line:
series.Line(dataSeries.Values).Name(dataSeries.Description);
break;
case ChartType.Pie:
series.Pie(dataSeries.Values).Name(dataSeries.Description);
break;
}
}
})
How should I approach this in Ajax binding? What value should I use in the "foreach" at the top of the Series configuration, if indeed this is supported at all? I've looked at the Ajax sample and it seems more straightforward.
My Ajax controller basically does something like this:
UIReport myreport = GetUIReport();
return new JSON(myreport);
Thanks for any pointers.
Chris