Home Forums Chart Support Adding the decimal places to the Y-axis Reply To: Adding the decimal places to the Y-axis

#41854

@elanchezhiyan,

You can use labelFormatter function instead of valueFormatString and set the label format using the formatNumber() method. Please take a look at the code snippet below.

labelFormatter: function(e) {
   if(e.value >= 0 && e.value <= 1)
      return CanvasJS.formatNumber(e.value, "0.00");
   else if (e.value >= 1 && e.value <=10 )
      return CanvasJS.formatNumber(e.value, "0.0");
   else 
      return CanvasJS.formatNumber(e.value, "0");
}

Please check this updated JSFiddle for a working example.


Thangaraj Raman
Team CanvasJS