score:5

Accepted answer

you misunderstood how chart.js is working (which i can understand since it is a real mess to edit it).

what you want to edit is the tick labels of your axes, and not their title.
then, you must know that the fontsize and fontcolor attributes you are looking for are stored in scales.xaxes.ticks.

so you just have to edit them like this :

var options = {
    // ...
    scales: {
        xaxes: [{
            ticks: {
                fontsize: 30,
                fontcolor: "red"
            }
        }]
    }
    // ...
}

and then add this var to your chart options.


here is a fully working example of you what you want :

var ctx = document.getelementbyid("mychart");
var mychart = new chart(ctx, {
    type: 'bar',
    data: {
        labels: ["red", "blue", "yellow", "green", "purple", "orange"],
        datasets: [{
            label: '# of votes',
            data: [12, 19, 3, 5, 2, 3],
            backgroundcolor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            bordercolor: [
                'rgba(255,99,132,1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)',
                'rgba(75, 192, 192, 1)',
                'rgba(153, 102, 255, 1)',
                'rgba(255, 159, 64, 1)'
            ],
            borderwidth: 1
        }]
    },
    options: {
        scales: {
            yaxes: [{
                ticks: {
                    // edit here for the yaxe
                    beginatzero:true,
                    fontcolor: "red",
                    fontsize: 30
                }
            }],
            xaxes: [{
                ticks: {
                    // edit here for the xaxe
                    fontcolor: "#456ef4",
                    fontsize: 20
                }
            }]
        }
    }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.1.6/chart.min.js"></script>
  
<canvas id="mychart" width="400" height="400"></canvas>

score:1

you should have a look at the latest doc: http://www.chartjs.org/docs/.

the font size can be set by changing scalelabel object

        scales: {
            xaxes: [{
                type: "time",
                gridlines : {
                    display : false
                },
                scalelabel : { fontcolor: '#6e6e6e', fontsize:16 }
            }],
        },

Related Query

More Query from same tag