Remove the white border from Chart.js pie chart - Javascript Chart.js

Javascript examples for Chart.js:Pie Chart

Description

Remove the white border from Chart.js pie chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Chart.js (v2) Pattern Fills</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.7.0/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//  w  w  w.ja  v  a  2 s.co  m
var ctx = document.getElementById("chart").getContext("2d");
var data = {
    labels: [
        "Red",
        "Green",
        "Yellow"
    ],
    datasets: [
        {
            data: [300, 50, 100],
            backgroundColor: [
                '#ff3300',
                "#46BFBD",
                "#FDB45C"
            ],
            hoverBackgroundColor: [
                "#FF5A5E",
                "#5AD3D1",
                "#FFC870"
            ]
        }]
};
var options = {
  elements: {
    arc: {
      borderWidth: 5, // <-- Set this to derired value
      borderColor:'#333'
    }
  }
};
var myNewChart = new Chart(ctx, {
  type: "doughnut",
  data: data,
  options: options
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="chart"></canvas>  
   </body>
</html>

Related Tutorials