Answers for "simple pie charts"

0

simple pie charts

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<div>
  <canvas id="myChart"></canvas>
</div>
 
<script>
const data = {
  labels: [
    'Red',
    'Blue',
    'Yellow'
  ],
  datasets: [{
    label: 'My First Dataset',
    data: [500, 5, 100],
    backgroundColor: [
      'rgb(255, 99, 132)',
      'rgb(54, 162, 235)',
      'rgb(255, 205, 86)'
    ],
    hoverOffset: 4
  }]
};
  
const config = {
  type: 'pie',
  data: data,
};
  
  var myChart = new Chart(
    document.getElementById('myChart'),
    config
  );
</script>
Posted by: Guest on August-25-2021

Browse Popular Code Answers by Language