From 553b20dc4417968d6b151fae60c5ad329b018802 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Tue, 21 Jun 2016 18:45:22 -0400 Subject: [PATCH] Gracefully handle creating the chart with no config --- src/core/core.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/core.js b/src/core/core.js index 06b707354..9000dbd22 100755 --- a/src/core/core.js +++ b/src/core/core.js @@ -6,7 +6,11 @@ module.exports = function() { var Chart = function(context, config) { var me = this; var helpers = Chart.helpers; - me.config = config; + me.config = config || { + data: { + datasets: [] + } + }; // Support a jQuery'd canvas element if (context.length && context[0].getContext) { @@ -45,10 +49,7 @@ module.exports = function() { // High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale. helpers.retinaScale(me); - - if (config) { - me.controller = new Chart.Controller(me); - } + me.controller = new Chart.Controller(me); // Always bind this so that if the responsive state changes we still work helpers.addResizeListener(context.canvas.parentNode, function() { -- 2.47.2