How to access specific data in series when sending grouped data to a view [MVC]

2 posts, 1 answers
  1. Answer
    Mateusz
    Mateusz avatar
    7 posts
    Member since:
    Aug 2013

    Posted 13 Aug 2013 Link to this post

    Hey guys. I'm new to Kendo UI and basically to MVC framework but that is the tool I have to use so... :)

     In the example below IEnumerable is used to simply enumerate over entire data stored in Close.
    But if I send data as a List

    @model List<Kendo.Mvc.Examples.Models.StockDataPoint>

    and later would like to access specific data(not all data like hereseries.Column(model => model.Close)  )  how could I do that exactly ?

    http://demos.kendoui.com/dataviz/bar-charts/grouped-data.html

    @model IEnumerable<Kendo.Mvc.Examples.Models.StockDataPoint>
     
    <div class="chart-wrapper">
        @(Html.Kendo().Chart(Model)
            .Name("chart")
            .Title("Stock Prices")
            .DataSource(dataSource => dataSource
                .Read(read => read.Action("_StockData", "Scatter_Charts"))
                .Group(group => group.Add(model => model.Symbol))
                .Sort(sort => sort.Add(model => model.Date).Ascending())
            )
            .Series(series => {
                series.Column(model => model.Close)
                    .Name("#= group.value # (close)");
            })
            .Legend(legend => legend
                .Position(ChartLegendPosition.Bottom)
            )
            .ValueAxis(axis => axis.Numeric()
                .Labels(labels => labels
                    .Format("${0}")
                    .Skip(2)
                    .Step(2)
                )
            )
            .CategoryAxis(axis => axis
                .Categories(model => model.Date)
                .Labels(labels => labels.Format("MMM"))
            )
        )
    </div>
     
  2. Mateusz
    Mateusz avatar
    7 posts
    Member since:
    Aug 2013

    Posted 14 Aug 2013 Link to this post

    Ok i managed with this line :P .Group(group => group.Add(model => model.Symbol)) I didn't use it before in my project
Back to Top