Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/core/core.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scales/scale.linearbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions test/specs/core.helpers.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down