[Chartjs]-Change color of X and Y axis values in Chart.js

58👍

Okay, so I figured it out. It’s the ticks property I’m looking for…see code below.

See updated jsfiddle: https://jsfiddle.net/o534w6jj/1/

var ctx = $("#weekly-clicks-chart");
var weeklyClicksChart = new Chart(ctx, {
    type: 'line',
    data: data,
    scaleFontColor: 'red',
    options: {
            scaleFontColor: 'red',
        responsive: true,
        tooltips: {
            mode: 'single',
        },
        scales: {
            xAxes: [{ 
                gridLines: {
                    display: false,
                },
                ticks: {
                  fontColor: "#CCC", // this here
                },
            }],
            yAxes: [{
                display: false,
                gridLines: {
                    display: false,
                },
            }],
        }
    }         
});

12👍

for anyone using Chartjs v3+ you can try this.

    options: {
      ...
      scales: {
        y: {
          ticks: {
            color: 'red'
          }
        }
        ,
      }
    }

Leave a comment