Skip to content

Commit 38bd8c2

Browse files
gbereweaverryan
authored andcommitted
Update chart.js. Resolves #86
1 parent a3da92d commit 38bd8c2

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/Chartjs/Resources/assets/dist/controller.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { Controller } from '@hotwired/stimulus';
2-
import { Chart } from 'chart.js';
2+
import Chart from 'chart.js/auto';
33

4-
class controller extends Controller {
4+
class default_1 extends Controller {
55
connect() {
66
if (!(this.element instanceof HTMLCanvasElement)) {
77
throw new Error('Invalid element');
88
}
9-
const viewData = this.element.getAttribute('data-view');
10-
if (!viewData) {
11-
throw new Error('Missing data-view attribute.');
12-
}
13-
const payload = JSON.parse(viewData);
9+
const payload = this.viewValue;
1410
if (Array.isArray(payload.options) && 0 === payload.options.length) {
1511
payload.options = {};
1612
}
@@ -28,5 +24,8 @@ class controller extends Controller {
2824
this.element.dispatchEvent(userEvent);
2925
}
3026
}
27+
default_1.values = {
28+
view: Object,
29+
};
3130

32-
export { controller as default };
31+
export { default_1 as default };

src/Chartjs/Resources/assets/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
},
1616
"peerDependencies": {
1717
"@hotwired/stimulus": "^3.0.0",
18-
"chart.js": "^2.9.4"
18+
"chart.js": "^3.4.1"
1919
},
2020
"devDependencies": {
2121
"@hotwired/stimulus": "^3.0.0",
2222
"@types/chart.js": "^2.9.34",
23-
"chart.js": "^2.9.4",
23+
"chart.js": "^3.4.1",
2424
"jest-canvas-mock": "^2.3.0"
2525
}
2626
}

src/Chartjs/Resources/assets/src/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'use strict';
1111

1212
import { Controller } from '@hotwired/stimulus';
13-
import { Chart } from 'chart.js';
13+
import Chart from 'chart.js/auto';
1414

1515
export default class extends Controller {
1616
static values = {

0 commit comments

Comments
 (0)