Javascript examples for Chart.js:Chart Configuration
Chart.js to remove last point
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src=" https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script> <script type="text/javascript"> window.onload=function(){/*w w w. jav a2 s . c o m*/ var options = {}; var currData = { labels: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], datasets: [ { label: "Number of beers drunk in the last week", data: [5, 7, 10, 4, 2, 8, 3] } ]} removeLast = function() { dataArray = currData.datasets[0].data; dataArray.pop(); console.log(dataArray); currData.datasets[0].data = dataArray; console.log(currData.datasets[0].data) myLineChart.update(); } var ctx = document.getElementById("myChart").getContext("2d"); var myLineChart = new Chart(ctx).Line(currData); } </script> </head> <body> <canvas id="myChart" width="400" height="400"></canvas> <button onclick="removeLast()"> Remove </button> </body> </html>