score:31
Found the answer here.
Numbers are formatted with a subset of float formatting conventions from the C library funciton sprintf. The formatting is appended inside the variable brackets, separated by a colon. For example:
- Two decimal places: "
{point.y:.2f}
"- Thousands separator, no decimal places:
{point.y:,.0f}
- Thousands separator, one decimal place:
{point.y:,.1f}
So using :,.1f
inside the brackets will format the number correctly.
tooltip: {
pointFormat: '{series.name}: <b>{point.y}</b><br/>' + 'Count: <b>{point.count:,.1f}</b><br/>',
shared: true
}
score:3
In our case tooltipFormatter
applies format only for y
property, I found couple ways how to add format not only for y
,
add format for each tooltip and for each property like this
point.count:,.f
pointFormat: '{series.name}: <b>{point.count:,.f}</b><br/>' + 'Count: <b>{point.y}</b><br/>',
create small extension like this
(function (Highcharts) { var tooltipFormatter = Highcharts.Point.prototype.tooltipFormatter; Highcharts.Point.prototype.tooltipFormatter = function (pointFormat) { var keys = this.options && Object.keys(this.options), pointArrayMap = this.series.pointArrayMap, tooltip; if (keys.length) { this.series.pointArrayMap = keys; } tooltip = tooltipFormatter.call(this, pointFormat); this.series.pointArrayMap = pointArrayMap || ['y']; return tooltip; } }(Highcharts));
score:16
Instaed of pointFormat, use the tooltip formatter and then Highcharts.numberFormat
tooltip: {
formatter:function(){
return this.point.series.name + ': <b>' + Highcharts.numberFormat(this.point.options.count,1,',','.') + '</b><br/>' + 'Count: <b>'+Highcharts.numberFormat(this.point.y,1,',','.')+'</b><br/>';
}
},
Example: http://jsfiddle.net/8rx1ehjk/4/
Source: stackoverflow.com
Related Query
- Format tooltip numbers in Highcharts
- Customize tooltip and format the number to 2 decimal places of highcharts
- highcharts tooltip format millions billions
- Highcharts tooltip date format when using pointFormat
- Format highcharts tooltip
- Format highcharts date tooltip to display timezone
- How to edit tooltip in Highcharts C# code
- how to use highcharts tooltip formatter in python code
- Highcharts Format tooltip for linkedTo: ':previous'
- Format Highcharts chart tooltip pointFormat in formatter
- Highcharts tooltip format different with series
- Tooltip in Highcharts doesn't show the right format for Date
- Highcharts - Format overlapping scatter points in a shared tooltip
- Getting numbers on Y-axis to show up as percentages with code from a Highcharts code generator tool?
- Format tooltip according to series in Highcharts
- Highcharts: Format all numbers with comma?
- Disable highcharts tooltip on certain lines, leave it enabled on others?
- Highcharts tooltip overflow is hidden
- What format does the highcharts js library accept for dates?
- customize highcharts tooltip to show datetime
- Format Highcharts y-axis labels
- highcharts pass multiple values to tooltip
- Disable tooltip on certain points in Highcharts
- How to Format Highcharts dataLabels Decimal Points
- Highcharts tooltip always on right side of cursor
- Highcharts tooltip formatter
- Weird character in front of Highcharts tooltip series names
- Display tooltip for invisible series in Highcharts
- Change Highcharts tooltip formatter from chart Object , after chart is rendered
- HighCharts show datetime format on xAxis
More Query from same tag
- Change Highchart graph amplitude through slider
- Multiple chart in same page Highchart
- Getting the selected range of the navigator
- Using highcharts to display data from an API
- highcharts how to make x and y axis starting on the same zero using categories on yAxis
- Highcharts Data Not Showing on Ajax Call
- Highstock Chart - I want the chart to start at position 0% (beginning) on the x-axis
- Hiding HighCharts StackLabels when series is large
- Bubble chart with NextJS and highcharts-react-official
- Highcharts import loading properly in Django - Python
- set highchart margin
- Prevent strtotime being encoded as string by json_encode
- Highcharts graph shows 265 series and no data after update to categories and series
- How to get access to previous value on formatter of xAxis label , Highcharts?
- gridLineDashStyle of Highchart missing grid line at bottom when only one item as bellow demo
- How to use a javascript variable in highcharts series?
- Highchart.js is not working properly in pure IE8
- Highstock/highcharts - yAxis title width
- Format styles based on some conditions in highcharts
- Highchart custom styling
- How to get xAxis and yAxis information on a Highcharts heatmap click event?
- Highcharts: collecting all charts on a page second time produces error
- Why is my secondary yAxis not matching to my xAxis in Highcharts?
- Highcharts Compare Date Ranges Bar Chart
- How to calculate group padding in Highcharts based on x-axis width
- Highmaps downloadXLS() issue with MacOS Safari
- Highcharts Change Bar Color Based on Value
- Highcharts: Too many datapoints in scatter - only circles get rendered
- change the legend.y property on browser resize
- Highcharts Stacked Column chart from JSON not charting correct values