However, in practical applications once the number of prime numbers in the data, the Highcharts report will be the problem of improper treatment of decimal places (although we have been rounding up the data point), as shown in detail.
My solution is to view uncompressed original development version JS, version: License Highcharts JS v2.2.4 (2012-05-31).
Point.prototype the value of the percentage field in the Getlabelconfig function in this class is modified to "Math.Round (point.percentage,2)".
Line 10,938th. /**
The code is as follows |
Copy Code |
/** * Return the configuration hash needed for the data label and tooltip formatters */ Getlabelconfig:function () { var point = this; return { X:point.category, Y:point.y, Key:point.name | | Point.category, Series:point.series, Point:point, Percentage:Math.round (point.percentage,2),//point.percentage Total:point.total | | Point.stacktotal }; }, |
Then the Highcharts code purification compression can be placed in the production environment.
And take a look at this jquery report plug-in highcharts after processing the effect diagram,
The drawback is that the sum of the items after this processing may not be 100%. Helpless