ChartJS BoxWidth settings - Javascript Chart.js

Javascript examples for Chart.js:Chart Configuration

Description

ChartJS BoxWidth settings

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from w w  w  . j  a  v  a  2 s  .  c o  m
var ctx = document.getElementById("completions");
    var myChart = new Chart(ctx, {
        type: 'doughnut',
        data: {
              labels: ['Completion'],
            datasets: [{
                data: [60, 20],
                backgroundColor: [
                    'rgba(255, 99, 132, 0.8)',
                    'rgba(54, 162, 235, 0)',
                ],
                borderWidth: 0
            }]
        },
        options: {
            responsive: false,
            cutoutPercentage: 90,
            events: [],
            legend: {
              labels: {
                  boxWidth: 0
              }
          }
        }
    });
    }

      </script> 
   </head> 
   <body> 
      <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script> 
      <canvas id="completions" width="200px" height="200px"></canvas>  
   </body>
</html>

Related Tutorials