Javascript examples for Chart.js:Legend
Change Radius/Point size of Legend Points in chart.js when usePointStyle is true
<html> <head> <title>ChartJS Line Chart</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.js"></script> <style id="compiled-css" type="text/css"> canvas { background-color : #eee; } .pieLegend li span{ display: inline-block; width: 12px; height: 12px; margin-right: 5px; } </style> <script type="text/javascript"> window.onload=function(){/*w w w .j a v a2 s. c o m*/ var options = { type: 'line', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [ { label: 'Votes', data: [12, 19, 3, 5, 2, 3], borderWidth: 1 }, { label: 'Points', data: [7, 11, 5, 8, 3, 7], borderWidth: 1 } ] }, options: { legend: { labels: { fontSize: 2, usePointStyle:true, } } } } var ctx = document.getElementById('chartJSContainer').getContext('2d'); var myChart = new Chart(ctx, options); document.getElementById('js-legend').innerHTML = myChart.generateLegend(); } </script> </head> <body> <!--<div id="js-legend" class="pieLegend"></div>--> <canvas id="chartJSContainer" width="600" height="400"></canvas> </body> </html>