[Chartjs]-How to hide zero data value from chartjs?

12👍

Finally solve myself. its a silly answer. I need to add an else statement in order to make the zero disappear.

 plugins: {
            datalabels: {
                display: true,
                align: 'center',
                anchor: 'center',
                formatter: function(value, index, values) {
                            if(value >0 ){
                                value = value.toString();
                                value = value.split(/(?=(?:...)*$)/);
                                value = value.join(',');
                                return value;
                            }else{
                                value = "";
                                return value;
                            }
                        }
                    }
             }

Leave a comment