score:1

Accepted answer

chartjs doesn't have a public api to do this but you can modify internal _ticks on beforedraw and make the label "blue" as major: true then that label will be drawn using the major styling in tick configuration options.

also use this with caution since it relies on internal implementation and thus might break in future releases (very unlikely to happen but just saying).

var ctx = document.getelementbyid("mychart").getcontext('2d');
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: {
                    beginatzero:true
                }
            }],
            xaxes: [{
                ticks: {
                    fontsize: 16,
                    major: {
                      fontsize: 20
                    }
                }
            }]
        }
    }, 
    plugins: [{
        beforedraw: function({ chart }, options) {
            chart.boxes
            .find(box => box.id === "x-axis-0")
            ._ticks
            .find(tick => tick.label === "blue")
            .major = true;
        }
    }]
});
<canvas id="mychart"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.7.3/chart.min.js"></script>

ps: just in case someone is wondering how i know this internal implementation i searched filltext in chartjs github source code and console.log(mychart) xd

score:0

for chartjs 3.0 and higher, it can be done by using scriptable-options. include it like this into your options for ticks:

options: {
    scales: {
             x: {
                  ticks: {

font: {
       size: (c) => {
         if (c.index==1){
             return 20 // at tick label with idx one set fontsize 20
          }
          else {
            return 12 // for all other tick labels set fontsize 12
          }
}, 
},
},
},
},
},

score:1

looks like it's not possible according to their docs. you can only do something like uppercase needed label with callback function

xaxes: [{
  ticks: {
    fontsize: 16,
    callback: v => v === 'blue' ? v.touppercase() : v
  }
}]

Related Query

More Query from same tag