Highcharts Report plugin redundant bug fixes for small digits

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.