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

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

1 Answer 32 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Mateusz
Top achievements
Rank 1
Mateusz asked on 13 Aug 2013, 10:31 AM
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>
 

1 Answer, 1 is accepted

Sort by
0
Mateusz
Top achievements
Rank 1
answered on 14 Aug 2013, 08:42 AM
Ok i managed with this line :P .Group(group => group.Add(model => model.Symbol)) I didn't use it before in my project
Tags
Charts
Asked by
Mateusz
Top achievements
Rank 1
Answers by
Mateusz
Top achievements
Rank 1
Share this question
or