Hide grid lines but show legend on chart.js - Javascript Chart.js

Javascript examples for Chart.js:Line Chart

Description

Hide grid lines but show legend on chart.js

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.bundle.js"></script> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.bundle.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*from   w w w. jav a 2s .  c om*/
var canvas = document.getElementById("wlPiechart");
            var ctx = canvas.getContext("2d");
            var wlPiechart = new Chart(ctx, {
                  type: 'pie',
                  data: {
                     labels: ["Pass", "Retrain", "Fail"],
                     datasets: [{
                        label: ["Pass", "Retrain", "Fail"],
                        data: [50, 25, 25],
                        backgroundColor: [
                           'rgba(255, 99, 132, 0.8)',  //change transparency here
                           'rgba(54, 162, 235, 0.8)',
                           'rgba(255, 206, 86, 0.8)']
                     }]
                  },
                  options: {
                     animation:{
                        animateRotate:true
                     },
                  }
               });
    }

      </script> 
   </head> 
   <body> 
      <div class="col-sm-12" style="width: 50%;"> 
         <canvas id="wlPiechart"></canvas> 
      </div>  
   </body>
</html>

Related Tutorials