Chart.helpers.retinaScale(this);
// Always bind this so that if the responsive state changes we still work
+ if (config) {
+ this.controller = new Chart.Controller(this);
+ }
+
var _this = this;
Chart.helpers.addResizeListener(context.canvas.parentNode, function() {
- if (config.options.responsive) {
+ if (_this.controller && _this.controller.config.options.responsive) {
_this.controller.resize();
}
});
- if (config) {
- this.controller = new Chart.Controller(this);
- return this.controller;
- }
-
- return this;
+ return this.controller ? this.controller : this;
};