Loading the series with data

2 posts, 0 answers
  1. Tony
    Tony avatar
    1 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post

    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>
  2. Hubert
    Hubert avatar
    19 posts
    Member since:
    Feb 2012

    Posted 08 Aug 2012 Link to this post

    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)
    )
    )
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top