Hello:
I have a property in my CodeBehind that return JSON data:
obj actually contains data and the serialization works ok, the problem is that I don't know how to tell the kendo ui chart to use this datasource. Right now I'm trying this the following, the dataEvent var actually recieves the Json String but I don't know how to tell the chart to understand that datasource. If I use a Handler that uses the transport property to make the request everything works ok, but I need this approach.
Thanks for any help.
Code:
I have a property in my CodeBehind that return JSON data:
public string EventTypeCount{ get { JavaScriptSerializer js = new JavaScriptSerializer(); return js.Serialize((List<EventTypeCount>)obj); } set { ViewState["EventTypeCount"] = value; }}obj actually contains data and the serialization works ok, the problem is that I don't know how to tell the kendo ui chart to use this datasource. Right now I'm trying this the following, the dataEvent var actually recieves the Json String but I don't know how to tell the chart to understand that datasource. If I use a Handler that uses the transport property to make the request everything works ok, but I need this approach.
Thanks for any help.
Code:
function createChartEvents() { var dataEvent = '<%= EventTypeCount %>'; $("#chartEvents").kendoChart({ theme: "metro", dataSource: { data: dataEvent, dataType: "json" }, title: { text: "Estudios" }, legend: { position: "bottom" }, seriesDefaults: { type: "column", labels: { visible: true } }, series: [{ field: "CountMade", name: "Eventos Finalizados" }, { field: "CountUnmade", name: "Eventos Pendientes" }, { field: "CountCanceled", name: "Eventos Cancelados" }], categoryAxis: { field: "EventTypeName" }, dataBound: onDataBound, }); }