score:47
In in the tooltip option in the configuration object use Math.round() in the formatter function.
tooltip: {
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
}
},
score:0
try
percentageDecimals: 0
in your tooltip
score:4
tooltip: {
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage*100)/100 +' %';
}
},
score:6
Instead of use formatter
you can set yDecimals
as 2
:
tooltip: {
yDecimals: 2
}
yDecimals: Number
How many decimals to show in each series' y value. This is overridable in each series' tooltip options object. The default is to preserve all decimals.
score:22
There's a numberFormat
function available in the Highcharts API that you can use (see http://www.highcharts.com/ref/#highcharts-object).
Quoted from API doc:
numberFormat (Number number, [Number decimals], [String decimalPoint], [String thousandsSep]) : String
Formats a JavaScript number with grouped thousands, a fixed amount of decimals and an optional decimal point. It is a port of PHP's function with the same name. See PHP number_format for a full explanation of the parameters.
tooltip: {
formatter: function() {
return ''+ this.series.name +''+
this.x +': '+ Highcharts.numberFormat(this.y, 0, ',') +' millions';
}
}, ...
Parameters
- number: Number The raw number to format.
- decimals: Number The desired number of decimals.
- decimalPoint: String The decimal point. Defaults to "." or to the string specified globally in options.lang.decimalPoint.
- thousandsSep: String The thousands separator. Defaults to "," or to the string specified globally in options.lang.thousandsSep.
Returns
A string with with the input number formatted.
score:31
tooltip: {
valueDecimals: 2
},
Source: stackoverflow.com
Related Query
- Rounding results in highcharts jquery script
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Highcharts in JQuery Tabs - Resizing hidden tab code stops resizing visible tab
- Dynamically changing Highcharts Theme through Jquery code not working
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- Highcharts jQuery rendering problem - all browsers
- Loading Highcharts via shim using RequireJS and maintaining jQuery dependency
- jQuery UI Tabs and Highcharts display/rendering issue
- missing value in highcharts line graph results in no line, just points
- Highcharts / jQuery - destroy and rebuild chart with original options
- highcharts jquery dynamic change chart type column to bar
- jQuery datepicker with Highstocks / Highcharts
- want to sort highcharts tooltip results
- jquery calling highcharts generating error 17
- Loading Highcharts series from XML using jQuery
- Rails ActiveRecord group_by & sum db results for use with Lazy HighCharts
- Setting Highcharts maximum Y value to an exact amount without rounding
- Showing HighCharts in A JQuery Mobile application
- highcharts zero values results in graph half way instead at the bottom
- Highcharts zoom issue after upgrading to jQuery 1.8
- Highcharts v3.0.1 problems with rotating data labels in IE8 and jQuery v1.7.1
- Highcharts - Global configuration with common code and unique data & Headings
- Simple bar chart in jQuery HighCharts and MVC 2 application?
- jQuery - HighCharts Labels outside Series (Bar Chart)
- Explanation of why I need to wrap a highcharts jquery event in an angular $timeout to access properties
- Highcharts chart doesn't show in jquery dialog
- Highcharts Gauge chart is rounding down max number
- How to dynamically update highcharts using jQuery UI sliders
- JQuery mobile and highcharts integration
- HighCharts Stock Chart error code 18
More Query from same tag
- HighChart Time Series hours starting at 4pm
- Force Highcharts to use standalone framework instead of jquery?
- Highchairs how to prepend HTML to legend
- Customizing point popup of highcharts
- How to set intervals for multiple y-axis in Highcharts?
- how to show the little circle in tooltip of highcharts
- Parallelcoordinates in R-highcharter R
- Fill different colors in boxplot chart Highcharts
- Highchart does not load data from hidden input when using .val
- Is it possible to truncate legend items in Highcharts/Highstock
- Start chart from threshold
- Highcharts stacked bar chart - how to get the stacks values
- Group SQL data by JSON arrays
- Get name of clicked point in Highcharts when the point has drilldown
- How to integrate Highmap chart with angular 5 Application?
- Highcharts with swapping divs
- Klipfolio data integration with Highchart Javascript
- How can i add element with attributes to SVG using jquery
- create bubble chart (Highcharts) with rCharts package
- Highcharts - Pie inner circle size
- HighCharts graphics not working on Internet Explorer
- highcharts line chart passing in x values
- Change title when drilldown in Highcharts
- highcharts stockchart 1m and 3m not enabled
- Tooltip covering bar in highchart
- How do i export HIGHCHARTS chart to a .jpeg
- Highchart legend has clipped text
- Highchart - highstock scroll out of sync with zoom
- Highcharts donut hover all area
- Dynamic chart is not working properly (highcharts)?