[Chartjs]-ChartJS : How to leave just points without lines

30πŸ‘

βœ…

To show only the dots, you need to set the showLine property to false for your dataset.

Here is an example :

var chart = new Chart(ctx, {
   type: 'line',
   data: {
      labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
      datasets: [{
         label: '# of votes',
         data: [3, 4, 1, 5, 6],
         pointBackgroundColor: 'black',
         pointRadius: 5,
         fill: false,
         showLine: false //<- set this
      }]
   }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<canvas id="ctx"></canvas>

Leave a comment