We would like to update a data source when a refresh button is clicked. In my javascript file I have the following declared:
var seriesData1 = [{"UnitNumber":"1010", "percent":85, "PMTYPE":"ODOMETER", "CompCode":"000-003"}, {"UnitNumber":"1010", "percent":75, "PMTYPE":"Days", "CompCode":"000-005"}];
I have this defined in my index.html:
<script>
function createChart() {
$("#chart").kendoChart({
theme: $(document).data("kendoSkin") || "black",
dataSource: {
data: seriesData1
},
title: {
text: "PMs Due"
},
legend: {
position: "top"
},
seriesDefaults: {
type: "column"
},
series: [
{
name: "% Due",
field: "percent"
}
],
valueAxis: {
labels: {
format: "{0}%"
}
},
categoryAxis: {
field: "CompCode"
},
tooltip: {
visible: true,
format: "{0}%"
}
});
}
</script>
When I click on the refresh button I am changing the values as follows in my javascript:
seriesData1 = [{"UnitNumber":"1010", "percent":35, "PMTYPE":"ODOMETER", "CompCode":"000-060"}, {"UnitNumber":"1010", "percent":75, "PMTYPE":"Days", "CompCode":"000-005"}];
$(".chart").data("kendoChart").redraw();
All that has changed is the percent and comp code of the first record .
On first load data is displayed without error however when the button is clicked to redraw the graph, the data is cleared and nothing is updated leaving a blank chart.
Is there anything else that I have to do to update the data source?
var seriesData1 = [{"UnitNumber":"1010", "percent":85, "PMTYPE":"ODOMETER", "CompCode":"000-003"}, {"UnitNumber":"1010", "percent":75, "PMTYPE":"Days", "CompCode":"000-005"}];
I have this defined in my index.html:
<script>
function createChart() {
$("#chart").kendoChart({
theme: $(document).data("kendoSkin") || "black",
dataSource: {
data: seriesData1
},
title: {
text: "PMs Due"
},
legend: {
position: "top"
},
seriesDefaults: {
type: "column"
},
series: [
{
name: "% Due",
field: "percent"
}
],
valueAxis: {
labels: {
format: "{0}%"
}
},
categoryAxis: {
field: "CompCode"
},
tooltip: {
visible: true,
format: "{0}%"
}
});
}
</script>
When I click on the refresh button I am changing the values as follows in my javascript:
seriesData1 = [{"UnitNumber":"1010", "percent":35, "PMTYPE":"ODOMETER", "CompCode":"000-060"}, {"UnitNumber":"1010", "percent":75, "PMTYPE":"Days", "CompCode":"000-005"}];
$(".chart").data("kendoChart").redraw();
All that has changed is the percent and comp code of the first record .
On first load data is displayed without error however when the button is clicked to redraw the graph, the data is cleared and nothing is updated leaving a blank chart.
Is there anything else that I have to do to update the data source?