I am creating Highcharts from dynamic data and have negative values with dollar signs. But the formatter is showing them like:
$-4,322
When I want:
-$4,322
This is what I am using:
pointFormat: 'Year {point.x:.0f}: ${point.y:,.0f}'
Can anyone help with that? Thanks.
You can switch to the pointFormatter
function to format it this way.
For example ( JSFiddle ):
pointFormatter: function() {
var isNegative = this.y < 0 ? '-' : '';
return 'Year ' + this.x.toFixed(0) + ': ' + isNegative + '$' + Math.abs(this.y.toFixed(0));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.