Sorry if this isn't the proper way to ask this. I do not have 'reputation 50' to comment on a response to an identical question, and etiquette says I should not 'Answer' with a question.
I have the same problem as described in Add data to line chart using chart.js but the solution does not work for me. I am running a newer version of Chart.js (1.0.1-beta.4), and I have tried the older version 1.0.1-beta.3 as suggested. Everything works for me except addData(). I have commented out other methods that do work.
BTW, it is not clear to me how addData() targets a specific dataset within the Chart.
The documentation says:
The values array passed into addData should be one for each dataset in the chart.
However, I am only using one dataset.
Below is my code made as trivial as possible to demonstrate my problem.
The error I get is:
Uncaught TypeError: Cannot read property 'points' of undefined
I'm using Linux Mint 17 and Chrome Version 39.0.2171.71 (64-bit).
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<script src="/js/Chart.min.js"></script>
<script>
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
var lineChartData = {
labels : ["1","2","3"],
datasets : [
{
label: "Pulse",
data: [ 50, 60, 70 ],
},
]
};
var myLineChart = new Chart(ctx).Line( lineChartData, {} ) ;
// myLineChart.datasets[0].points[2].value = 100 ; // works
// myLineChart.update(); // works - resizes for y=100
// myLineChart.removeData() ; // works
myLineChart.addData( [4,80], "4"); // doesn't work
}
</script>
</head>
<body>
<div style="width:30%">
<div>
<canvas id="canvas" height="150" width="400"></canvas>
</div>
</div>
</body>
</html>