]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Core helpers reference
authorTanner Linsley <tannerlinsley@gmail.com>
Fri, 12 Feb 2016 06:45:14 +0000 (23:45 -0700)
committerTanner Linsley <tannerlinsley@gmail.com>
Fri, 12 Feb 2016 06:45:14 +0000 (23:45 -0700)
src/core/core.js

index 4bb22c8a31c5e47bd0e5204f10bde1598737a07d..80105af5514c9cc2e5d77fb6098d349cb5becfec 100755 (executable)
@@ -2,8 +2,6 @@
 
 module.exports = function() {
 
-  var helpers = require('./core.helpers')
-
   //Occupy the global variable of Chart, and create a simple base class
   var Chart = function(context, config) {
     this.config = config;
@@ -25,8 +23,8 @@ module.exports = function() {
     // If the canvas has a specified width and height, we use those else
     // we look to see if the canvas node has a CSS width and height.
     // If there is still no height, fill the parent container
-    this.width = context.canvas.width || parseInt(helpers.getStyle(context.canvas, 'width')) || helpers.getMaximumWidth(context.canvas);
-    this.height = context.canvas.height || parseInt(helpers.getStyle(context.canvas, 'height')) || helpers.getMaximumHeight(context.canvas);
+    this.width = context.canvas.width || parseInt(Chart.helpers.getStyle(context.canvas, 'width')) || Chart.helpers.getMaximumWidth(context.canvas);
+    this.height = context.canvas.height || parseInt(Chart.helpers.getStyle(context.canvas, 'height')) || Chart.helpers.getMaximumHeight(context.canvas);
 
     this.aspectRatio = this.width / this.height;
 
@@ -42,7 +40,7 @@ module.exports = function() {
     this.originalCanvasStyleHeight = context.canvas.style.height;
 
     // High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale.
-    helpers.retinaScale(this);
+    Chart.helpers.retinaScale(this);
 
     if (config) {
       this.controller = new Chart.Controller(this);
@@ -50,7 +48,7 @@ module.exports = function() {
 
     // Always bind this so that if the responsive state changes we still work
     var _this = this;
-    helpers.addResizeListener(context.canvas.parentNode, function() {
+    Chart.helpers.addResizeListener(context.canvas.parentNode, function() {
       if (_this.controller && _this.controller.config.options.responsive) {
         _this.controller.resize();
       }