I have a chart control defined in a .js file:
In the datasource I do an update of the series each time the grid regroups the values (notes: newData is the change: function, and typeSeries is a global variable:
But I am not seeing anything in the chart. (blank columns). I tried a chartViewer.refresh() but that just gave a i/o error. I need to set autoBind to false, since I need to poll the server at specific times for the JSON data to populate the datasource.
I know that my code is pretty close, since this JsFiddle test that I did shows that I can create a series and use it to display a chart. But here the data is all local, and I need a remote JSON source.
http://jsfiddle.net/drysg/gezJd/6/
var chartViewer;
function buildChart() {
chartViewer = $("#chartPane").kendoChart({
title: {
text: "Type by Distributor"
},
dataSource: searchData,
autoBind: false,
seriesDefaults: {
type: "column"
},
series: typeSeries,
tooltip: {visible: true}
});
chartViewer = $("#chartPane").data("kendoChart");
}
In the datasource I do an update of the series each time the grid regroups the values (notes: newData is the change: function, and typeSeries is a global variable:
function newData(e) {
var items = searchData.view();
var length = items.length;
var item;
$("#recCount").text(searchData.total());
typeSeries = [];
for (var i = 0; i < length; i++) {
item = items[i];
typeSeries.push({ name: item.value, data: [item.aggregates.type.count] })
}
// rebuildChart();
}
But I am not seeing anything in the chart. (blank columns). I tried a chartViewer.refresh() but that just gave a i/o error. I need to set autoBind to false, since I need to poll the server at specific times for the JSON data to populate the datasource.
I know that my code is pretty close, since this JsFiddle test that I did shows that I can create a series and use it to display a chart. But here the data is all local, and I need a remote JSON source.
http://jsfiddle.net/drysg/gezJd/6/