diff --git a/src/core/core.js b/src/core/core.js index be5654ef7..6260c3a69 100755 --- a/src/core/core.js +++ b/src/core/core.js @@ -20,6 +20,17 @@ //Occupy the global variable of Chart, and create a simple base class var Chart = function(context) { var chart = this; + + // Support a jQuery'd canvas element + if (context.length && context[0].getContext) { + context = context[0]; + } + + // Support a canvas domnode + if (context.getContext) { + context = context.getContext("2d"); + } + this.canvas = context.canvas; this.ctx = context;