Javascript examples for Chart.js:Line Chart
create line chart
<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.1.3/Chart.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script type="text/javascript"> window.onload=function(){//from ww w. j av a 2s. co m var lineChartData = { labels: [ "APPLES, GALA WAXF 138", "APPLES, GOLDEN DELICIOUS WAX100", "APPLES, GOLDEN DELICIOUS WAXF 113" ], datasets: [ { fillColor: "rgba(220,220,220,0.5)", strokeColor: "rgba(220,220,220,0.8)", highlightFill: "rgba(220,220,220,0.75)", highlightStroke: "rgba(220,220,220,1)", data: [49, 46, 153.86] }, { fillColor: "rgba(151,187,205,0.5)", strokeColor: "rgba(151,187,205,0.8)", highlightFill: "rgba(151,187,205,0.75)", highlightStroke: "rgba(151,187,205,1)", data: [52, 40, 65.00] }, { fillColor: "rgba(120,240,180,0.5)", strokeColor: "rgba(120,240,180,0.8)", highlightFill: "rgba(120,240,180,0.75)", highlightStroke: "rgba(120,240,180,1)", data: [42, 42, 227.70] } ] } var ctxLineChart = $("#forecastLineChart").get(0).getContext("2d"); var forecastImpactLineChart = Chart.Line(ctxLineChart, { data: lineChartData }); } </script> </head> <body> <canvas id="forecastLineChart"></canvas> </body> </html>