Reputation: 1
I high chart value like 1000000. How can I have it displayed with the proper commas in place like "10,000,000"
I write the regular expression like /(\d+)(\d{3})/
It working fine for normal function..but when i use this one in High charts then it returns undefined
Upvotes: 0
Views: 782
Reputation: 8346
You can also use "Format String"
For Tooltip:
tooltip: {
pointFormat: "Value: {point.y:,.0f}"
}
For x/y labels:
yAxis: {
labels: {
format: '{value:,.0f}'
}
}
Labels:
plotOptions: {
bar: {
dataLabels: {
enabled: true,
format : '{y:,.0f}'
}
}
}
Upvotes: 0
Reputation: 4776
you can use formatter availabele for labels,xAxis.labels, yAxis,labels, tooltip to format the numbers in your own way.
yAxis:{
labels:{
formatter: function(){
}
}
}
you can use the regular expression concept in that formatter function as well.
here is a example where i've applied my formatting on yAxis labels http://jsfiddle.net/2Jwsn/
I hope this will help you
Upvotes: 0
Reputation: 37588
You can use http://api.highcharts.com/highcharts#Highcharts.numberFormat in formatters like axis label or tooltip. Additionally you have a possibility of using lang paramter http://api.highcharts.com/highcharts#lang.thousandsSep
Upvotes: 1