Chartjs-Chart.js Version 3: how to set the different color for tick lines and gridlines

0👍

An easy way is to set Chart.defaults.borderColor to a new value before drawing your chart.

For example:

    Chart.defaults.borderColor = "rgba(255,255,255, .2)"; // White translucent, good for dark themes 
    let chart_options = {
      type: 'bar',
      data: {
        labels: labels,
        datasets: [{
          data: data_points,
          backgroundColor: colors
        }]
      }
    }
    var ctx = document.getElementById('some-chart').getContext('2d');
    new Chart(ctx, chart_options);

Leave a comment