How to add commas to numbers

Technical support, bug reports and more.

How to add commas to numbers

Postby noah977 on Fri Jul 30, 2010 11:47 pm

Hi,

I have data that is in the millions: [10000000,11000000] etc.

1) How can I have it displayed with the proper commas in place like "10,000,000"

2) The values are so long that the label on the Y axis is getting run over by them. Is there a way to automatically have the Y access name shift over to accomodate for this?

Thanks!
noah977
 
Posts: 8
Joined: Tue Jun 03, 2008 6:37 pm

Re: How to add commas to numbers

Postby not on Tue Aug 03, 2010 1:40 pm

As for question 1, you can use in-build Highcharts.numberFormater(...):
Code: Select all
yAxis: {
  labels: {
    formatter:function() {
      return Highcharts.numberFormat(this.value, 0, '', ',');
    }
  }
}


As for question 2, just use chart.marginLeft option to increase a space for values.
Maciej Piecha,
Highcharts Support Team
User avatar
not
 
Posts: 329
Joined: Mon Jun 07, 2010 4:01 pm


Return to Highcharts Usage

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron