Hide chart labels in doughnut chart - Javascript Chart.js

Javascript examples for Chart.js:Doughnut Chart

Description

Hide chart labels in doughnut 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://code.jquery.com/jquery-1.12.2.js"></script> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from w ww.ja v a 2s.c o  m
var scanedTodayChartCtx = document.getElementById("chart").getContext("2d");
var scanedTodayChart = new Chart(scanedTodayChartCtx, {
  type: 'doughnut',
  data: {
    labels: [
      "Red",
      "White",
    ],
    datasets: [{
      data: [10, 100],
      backgroundColor: [
        "#DA1A32",
        "#F0FFFF"
      ],
      borderWidth: false,
      borderColor: false
    }]
  },
  options: {
    legend: {
      labels: {
        generateLabels: function(chart) {
          return "";
        }
      }
    }
  }
});
    }

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

Related Tutorials