Javascript examples for Chart.js:Legend
Chart.js legend position
<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 w w w .j av a 2 s .c om var optionLabels = ['Jan', 'Feb'], optionData = [1, 2], optionColor = ['red', 'green']; var myChart = new Chart(ctx, { type: 'pie', data: { labels: optionLabels, datasets: [{ label: '# of Resources', data: optionData, backgroundColor: optionColor, borderColor: "white", borderWidth: 1, }] }, options: { legend: { position: 'left' } } }); } </script> </head> <body> <canvas id="ctx"></canvas> </body> </html>