formatNumber(number [, formatString] [, culture])

Formats number according to the given formatString(optional) & culture(optional). Default formatString is “#,##0.##” & default culture is “en”.


Note
  • This is a static function under CanvasJS namespace and it can be used directly without instantiating a chart. Hence you can also use it outside the chart too for formatting numbers.
  • Can be very useful inside Custom Formatter Functions


//Using CanvasJS.formatNumber.
var  chart =  new  CanvasJS.Chart("container",
{
	title:{
		text: "Chart with " + CanvasJS.formatNumber(100000) + " dataPoints" //gets formatted as 100,000
	},
. 
.
});

chart.render();

To know more about number format string , please refer to this section.

To know more about adding custom culture, info please refer to this section


Try it Yourself by Editing the Code below.


If you have any questions, please feel free to ask in our forums.Ask Question