JavaScript
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [65, 0, 80, 0, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 0, 0, 0, 90]
}
]
};
var ctx = document.getElementById("myChart").getContext("2d");
var myLineChart = new Chart(ctx).Line(data, {
animation: false,
onAnimationComplete: function () {
// prevents the update from triggering an infinite loop
if (!this.clearCycle) {
this.clearCycle = true;
this.datasets.forEach(function (dataset) {
dataset.points.forEach(function (point) {
if (point.value === 0) {
point.display = false;
point.hasValue = function () {
return false;
}
}
})
})
this.update();
}
else
delete this.clearCycle;
}
});