]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Make decimalPlaces private and update CDN links (#6131) 6092/head
authorJukka Kurkela <jukka.kurkela@gmail.com>
Wed, 13 Mar 2019 09:36:10 +0000 (11:36 +0200)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Wed, 13 Mar 2019 09:36:10 +0000 (10:36 +0100)
docs/README.md
docs/getting-started/README.md
src/core/core.helpers.js
src/scales/scale.linearbase.js
test/specs/core.helpers.tests.js

index d0b0544ab0c3f24eef14e3e201cc39923669bc8d..9592ecf2c10c7b77e76d48540c63e9641a091738 100644 (file)
@@ -4,7 +4,7 @@
 
 ## Installation
 
-You can download the latest version of Chart.js from the [GitHub releases](https://github.com/chartjs/Chart.js/releases/latest) or use a [Chart.js CDN](https://cdnjs.com/libraries/Chart.js). Detailed installation instructions can be found on the [installation](./getting-started/installation.md) page.
+You can download the latest version of Chart.js from the [GitHub releases](https://github.com/chartjs/Chart.js/releases/latest) or use a [Chart.js CDN](https://www.jsdelivr.com/package/npm/chart.js). Detailed installation instructions can be found on the [installation](./getting-started/installation.md) page.
 
 ## Creating a Chart
 
index 5a879c4ce5102b5b3dc9a9319a4c0c78701fd8af..9dd7ed684d062cc7c22db4aafce192835bfba873 100644 (file)
@@ -11,7 +11,7 @@ First, we need to have a canvas in our page.
 Now that we have a canvas we can use, we need to include Chart.js in our page.
 
 ```html
-<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
 ```
 
 Now, we can create a chart. We add a script to our page:
index 5b4aec34c7e9ccabff7fbc61a6cf9f75c6c6462c..7922747dee95d0e2128c2766c978de8349577570 100644 (file)
@@ -125,8 +125,9 @@ module.exports = function() {
         * i.e. the number of digits after the decimal point, of the value of this Number.
         * @param {number} x - A number.
         * @returns {number} The number of decimal places.
+        * @private
         */
-       helpers.decimalPlaces = function(x) {
+       helpers._decimalPlaces = function(x) {
                if (!helpers.isFinite(x)) {
                        return;
                }
index 24816e9225ed401bcdbfc96104433aa0f8bd0a50..7f68279db6cc26a302cdf61ea2c3147544d331b9 100644 (file)
@@ -44,7 +44,7 @@ function generateTicks(generationOptions, dataRange) {
 
        if (stepSize || isNullOrUndef(precision)) {
                // If a precision is not specified, calculate factor based on spacing
-               factor = Math.pow(10, helpers.decimalPlaces(spacing));
+               factor = Math.pow(10, helpers._decimalPlaces(spacing));
        } else {
                // If the user specified a precision, round to that number of decimal places
                factor = Math.pow(10, precision);
index b0c7431c8592a5ed8c68021e9edfcb4f541a1496..a075c0e8d85ccc96a3566f1953cdefd3f22f81db 100644 (file)
@@ -73,14 +73,14 @@ describe('Core helper tests', function() {
        });
 
        it('should get the correct number of decimal places', function() {
-               expect(helpers.decimalPlaces(100)).toBe(0);
-               expect(helpers.decimalPlaces(1)).toBe(0);
-               expect(helpers.decimalPlaces(0)).toBe(0);
-               expect(helpers.decimalPlaces(0.01)).toBe(2);
-               expect(helpers.decimalPlaces(-0.01)).toBe(2);
-               expect(helpers.decimalPlaces('1')).toBe(undefined);
-               expect(helpers.decimalPlaces('')).toBe(undefined);
-               expect(helpers.decimalPlaces(undefined)).toBe(undefined);
+               expect(helpers._decimalPlaces(100)).toBe(0);
+               expect(helpers._decimalPlaces(1)).toBe(0);
+               expect(helpers._decimalPlaces(0)).toBe(0);
+               expect(helpers._decimalPlaces(0.01)).toBe(2);
+               expect(helpers._decimalPlaces(-0.01)).toBe(2);
+               expect(helpers._decimalPlaces('1')).toBe(undefined);
+               expect(helpers._decimalPlaces('')).toBe(undefined);
+               expect(helpers._decimalPlaces(undefined)).toBe(undefined);
        });
 
        it('should get an angle from a point', function() {