I'm trying to get a chart to bind the series from a WebAPI call. The data is coming back in the following json format. Each object in the return should create one bar/column on the chart with the "Name" being the corresponding label/categoryAxis value.
Thoughts?
[{"Name":"Site1","Count":4,"Color":"#02bc84"},{"Name":"Site2","Count":3,"Color":"#f08080"}]
Thoughts?
[{"Name":"Site1","Count":4,"Color":"#02bc84"},{"Name":"Site2","Count":3,"Color":"#f08080"}]
4 Answers, 1 is accepted
0
Holger
Top achievements
Rank 1
answered on 23 Sep 2014, 06:16 AM
0
Rob
Top achievements
Rank 1
answered on 23 Sep 2014, 01:42 PM
Thanks Holger! That is what I'm looking for! Is it possible to do this using the Fluent or MVC HTMLHelper as well?
0
Holger
Top achievements
Rank 1
answered on 24 Sep 2014, 06:34 AM
Hello Rob,
I'm pretty sure it will be possible, but since I'm not using the ASP.NET MVC version of Kendo UI I cannot help you in this regard.
Regards,
Holger
I'm pretty sure it will be possible, but since I'm not using the ASP.NET MVC version of Kendo UI I cannot help you in this regard.
Regards,
Holger
0
Hi,
The MVC version of the sample provided by Holger will look similar to this:
@(Html.Kendo().Chart<MyModel>()
.DataSource(ds => ds.Read(read => read.Action("Read", "Data")))
.Series(series => { series
.Column(
model => model.Count,
colorExpression: model => model.Color)
.Name("Count");
})
.CategoryAxis(axis => axis
.Categories(model => model.Name)
)
)
You can check out the remote data binding demo as well.
I hope this helps.
Regards,
T. Tsonev
Telerik
The MVC version of the sample provided by Holger will look similar to this:
@(Html.Kendo().Chart<MyModel>()
.DataSource(ds => ds.Read(read => read.Action("Read", "Data")))
.Series(series => { series
.Column(
model => model.Count,
colorExpression: model => model.Color)
.Name("Count");
})
.CategoryAxis(axis => axis
.Categories(model => model.Name)
)
)
You can check out the remote data binding demo as well.
I hope this helps.
Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!