Skip to content

Update chart.js dependency #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 5 additions & 3 deletions src/Chartjs/Resources/assets/dist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ exports["default"] = void 0;

var _stimulus = require("stimulus");

var _chart = require("chart.js");
var _auto = _interopRequireDefault(require("chart.js/auto"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

Expand All @@ -35,7 +37,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

Expand Down Expand Up @@ -63,7 +65,7 @@ var _default = /*#__PURE__*/function (_Controller) {
options: payload.options
});

var chart = new _chart.Chart(this.element.getContext('2d'), payload);
var chart = new _auto["default"](this.element.getContext('2d'), payload);
Copy link
Contributor Author

@gbere gbere Jul 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From tests:

var chart = new _auto["default"](this.element.getContext('2d'), payload);

ReferenceError: ResizeObserver is not defined.

But from one application works well


this._dispatchEvent('chartjs:connect', {
chart: chart
Expand Down
4 changes: 2 additions & 2 deletions src/Chartjs/Resources/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lint": "eslint src test"
},
"peerDependencies": {
"chart.js": "^2.9.4",
"chart.js": "^3.4.1",
"stimulus": "^2.0.0"
},
"devDependencies": {
Expand All @@ -28,7 +28,7 @@
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/preset-env": "^7.12.7",
"@symfony/stimulus-testing": "^1.1.0",
"chart.js": "^2.9.4",
"chart.js": "^3.4.1",
"jest-canvas-mock": "^2.3.0",
"stimulus": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Chartjs/Resources/assets/src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'use strict';

import { Controller } from 'stimulus';
import { Chart } from 'chart.js';
import Chart from 'chart.js/auto';

export default class extends Controller {
connect() {
Expand Down