Here is my code but it does not work... shows nothing :|
what have i done wrong?
how to call the datasource in the function?
<div id="example" class="k-content absConf">
<div class="chart-wrapper" style="margin: auto;">
<div id="chart"></div>
</div>
<script type="text/javascript">
var transport = {
read: {
url: "..."
}
};
var data = new kendo.data.DataSource({
transport: transport,
sort: {
field: "day",
dir: "asc"
}
});
function createChart() {
$("#chart").kendoChart({
theme: $(document).data("kendoSkin") || "silver",
dataSource: data,
title: {
text: "Value per day"
},
legend: {
position: "top",
font: "18px Verdana"
},
seriesDefaults: {
type: "line"
},
series:
[{
field: "value",
name: "value"
}],
valueAxis: {
field: "value"
},
categoryAxis: {
field: "day"
},
tooltip: {
visible: true,
format: "N0"
}
});
}
$(document).ready(function () {
setTimeout(function () {
createChart();
$("#example").bind("kendo:skinChange", function (e) {
createChart();
data.read();
});
}, 400);
});
</script>
</div>
and the result from the webservice :
{ "day": "Monday", "value": 10 }, { "day": "Tuesday", "value": 18 }, { "day": "Wednesday", "value": 43 } ;