It would be nice to send some meta information about the data along with the records.
I want to dynamically show series based on the value of one of the bound fields in the datasource. If there are no records I don't want to show a donut chart ring for example.
Currently, I have to resort to some brittle logic in the change event of the datasource to do the trick.
If I could create a datasource that would look more like the following:
If I could then bind the chartData as my chart datasource instead of the data starting at the root that would be great!
I want to dynamically show series based on the value of one of the bound fields in the datasource. If there are no records I don't want to show a donut chart ring for example.
Currently, I have to resort to some brittle logic in the change event of the datasource to do the trick.
change: function (e) {
var item = this.data()[0];
var chart = $("#training-chart").data("kendoChart");
// find the empty donut items.
if (item.numberCompleted == 0)
chart.options.series.splice(0, 1);
if(item.numberExpired == 0)
chart.options.series.splice(1, 1);
if (item.numberNotTaken == 0)
chart.options.series.splice(2, 1);
if (item.numberDue == 0)
chart.options.series.splice(3, 1);
chart.refresh();
},
data =
{
metaproperty : someUsefulInfo,
chartData : [ { data: 1 }, { data: 2 },{ data: 3 }]
}
If I could then bind the chartData as my chart datasource instead of the data starting at the root that would be great!