Javascript examples for Chart.js:Pie Chart
Set border color for pie 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.5.0/Chart.min.js"></script> <script type="text/javascript"> window.onload=function(){//from w ww . j a va 2s . com var ctx = document.getElementById("chartPic").getContext('2d'); var chart = new Chart(ctx, { type: 'pie', data: { labels: ["red", "green", "blue"], datasets: [{ label: 'Number of votes', data: [1, 1, 1], backgroundColor: ['red', 'green', 'blue'], borderColor: ['green', 'blue', 'red'], borderWidth: 1 }] }, options: { title: { display: true, text: "chart" }, legend: { position: 'bottom' } } }); } </script> </head> <body> <canvas id="chartPic"></canvas> </body> </html>