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

Loading the series with data

1 Answer 147 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 19 Jul 2012, 08:30 PM
Hi Everyone,

Here is my code snippet....
I need to know how to load the series data from information in the controller.
       <tr>
           <td>
              @* ToDo uncomment the follwing to activate Telerik Chart *@
               @(Html.Telerik().Chart<Qforma.Data.Physician>()
.Name("TimeSeries")
.Title(title => title.Text("Time Series"))
.Transitions(true)
 //.PlotArea(area => area.Background("#ccff00"))
.Legend(legend => legend.Position(ChartLegendPosition.Bottom)
)
.Series(series =>
{
    series.Bar(new int[] { 3015, 4003, 5881 }).Name("one");
    series.Bar(new int[] { 10458, 18598, 22623 }).Name("two");
})
.CategoryAxis(axis => axis
.Categories(new string[] { "Aug 2010", "Sept 2010", "Oct 2010" })
)
)
           </td>
       </tr>

1 Answer, 1 is accepted

Sort by
0
Hubert
Top achievements
Rank 1
answered on 08 Aug 2012, 02:27 PM
Hi,

do you mean something like that?
I iterate over a series data model in Model.
At the top is the model defined: @model MyApplication.Models.DataModel
@(Html.Telerik().Chart<Qforma.Data.Physician>()
.Name("TimeSeries")
.Title(title => title.Text("Time Series"))
.Transitions(true)
.Legend(legend => legend.Position(ChartLegendPosition.Bottom)
)
.Series(series =>
{
   foreach(var dataItem in Model.MyData) {
    series.Bar(dataItem.Data).Name(dataItem.Name);
   }
})
.CategoryAxis(axis => axis
.Categories(Model.MyCategories)
)
)
Tags
Chart
Asked by
Tony
Top achievements
Rank 1
Answers by
Hubert
Top achievements
Rank 1
Share this question
or