Javascript examples for Chart.js:Line Chart
Draw line chart with connected dots using chartJS
<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/2.7.0/Chart.min.js"></script> <script type="text/javascript"> window.onload=function(){//from ww w . j a va 2s .c o m var chart = new Chart(ctx, { type: 'scatter', data: { datasets: [{ data: [{ x: 1, y: 1 }, { x: 3, y: 7 }, { x: 6, y: 5 }, { x: 1, y: 1 }], borderColor: 'black', borderWidth: 1, pointBackgroundColor: ['#000', '#00bcd6', '#d300d6'], pointBorderColor: ['#000', '#00bcd6', '#d300d6'], pointRadius: 5, pointHoverRadius: 5, fill: false, tension: 0, showLine: true }, { data: [{ x: 3.5, y: 4.5 }], pointBackgroundColor: 'orange', pointBorderColor: 'darkorange', pointRadius: 10, pointHoverRadius: 10 }] }, options: { legend: false, tooltips: false, scales: { xAxes: [{ ticks: { min: 0, max: 10 }, gridLines: { color: '#888', drawOnChartArea: false } }], yAxes: [{ ticks: { min: 0, max: 8, padding: 10 }, gridLines: { color: '#888', drawOnChartArea: false } }] } } }); } </script> </head> <body> <canvas id="ctx"></canvas> </body> </html>