Set border color for pie chart - Javascript Chart.js

Javascript examples for Chart.js:Pie Chart

Description

Set border color for pie chart

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials