Change color of X and Y axis values in Chart.js

前端 未结 1 1227
独厮守ぢ
独厮守ぢ 2020-12-30 23:09

I\'m using v2.*. However, I can\'t seem to set the default color for a line chart. I\'m mainly looking to set the color of the x/y chart values. I figured the below might do

相关标签:
1条回答
  • 2020-12-30 23:55

    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,
                    },
                }],
            }
        }         
    });
    
    0 讨论(0)
提交回复
热议问题