Chartjs-ChartJS for 1 and 0 values display true or false

0πŸ‘

βœ…

If you want to generate the desired result along the yAxes, use something similar to this:

yAxes:[{
    ticks:{
        callback:function(value,index,values){
            if (value == 1) return "True";
            if (value == 0) return "False";
        }
    }
}]

0πŸ‘

For later version of chart.js the code is

y:{
    ticks:{
        callback:function(value,index,values){
            if (value == 1) return "True";
            if (value == 0) return "False";
        }
    }
}

Leave a comment