]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Merge `Chart.scales` into `Chart.scaleService` to be consistent 1205/head
authorEvert Timberg <evert.timberg@gmail.com>
Sat, 13 Jun 2015 13:55:43 +0000 (09:55 -0400)
committerEvert Timberg <evert.timberg@gmail.com>
Sat, 13 Jun 2015 13:55:43 +0000 (09:55 -0400)
src/charts/chart.bar.js
src/charts/chart.line.js
src/charts/chart.polarArea.js
src/charts/chart.radar.js
src/core/core.scale.js
src/scales/scale.category.js
src/scales/scale.linear.js
src/scales/scale.radialLinear.js

index 358a5fe016a59b1022a54a0dd8a3735367fee377..e16161bb220bb9ea9ebc771c7de7f1cd2bd4c910 100644 (file)
             this.scales = {};
 
             // Build the x axis. The line chart only supports a single x axis
-            var ScaleClass = Chart.scales.getScaleConstructor(this.options.scales.xAxes[0].type);
+            var ScaleClass = Chart.scaleService.getScaleConstructor(this.options.scales.xAxes[0].type);
             var xScale = new ScaleClass({
                 ctx: this.chart.ctx,
                 options: this.options.scales.xAxes[0],
 
             // Build up all the y scales
             helpers.each(this.options.scales.yAxes, function(yAxisOptions) {
-                var ScaleClass = Chart.scales.getScaleConstructor(yAxisOptions.type);
+                var ScaleClass = Chart.scaleService.getScaleConstructor(yAxisOptions.type);
                 var scale = new ScaleClass({
                     ctx: this.chart.ctx,
                     options: yAxisOptions,
index d68a9964e16087c058ff86468ce11dc17f90027a..779f78e3f66b4174b0fb6e666dafd71e1cb7c44a 100644 (file)
 
                        // Build the x axes
                        helpers.each(this.options.scales.xAxes, function(xAxisOptions) {
-                               var ScaleClass = Chart.scales.getScaleConstructor(xAxisOptions.type);
+                               var ScaleClass = Chart.scaleService.getScaleConstructor(xAxisOptions.type);
                                var scale = new ScaleClass({
                                        ctx: this.chart.ctx,
                                        options: xAxisOptions,
 
                        // Build the y axes
                        helpers.each(this.options.scales.yAxes, function(yAxisOptions) {
-                               var ScaleClass = Chart.scales.getScaleConstructor(yAxisOptions.type);
+                               var ScaleClass = Chart.scaleService.getScaleConstructor(yAxisOptions.type);
                                var scale = new ScaleClass({
                                        ctx: this.chart.ctx,
                                        options: yAxisOptions,
index 72f4b8f76682c7caf49c8cfd53c4f8153c8419f7..4131e6bc01c0b2924ccc9b5c8a3ed24ef4348987 100644 (file)
@@ -66,7 +66,7 @@
 
                        // Scale setup
                        var self = this;
-                       var ScaleClass = Chart.scales.getScaleConstructor(this.options.scale.type);
+                       var ScaleClass = Chart.scaleService.getScaleConstructor(this.options.scale.type);
                        this.scale = new ScaleClass({
                                options: this.options.scale,
                                lineArc: true,
index 2fcf88ba050d94aa44c1594675d1b721e9d3314b..3d911070f94d0d94ece152e0535604fffb3f9064 100644 (file)
                buildScale: function() {
                        var self = this;
 
-                       var ScaleConstructor = Chart.scales.getScaleConstructor(this.options.scale.type);
+                       var ScaleConstructor = Chart.scaleService.getScaleConstructor(this.options.scale.type);
                        this.scale = new ScaleConstructor({
                                options: this.options.scale,
                                height: this.chart.height,
index 3d56f6346908a980ba9cb119d36aa822920bd3d1..dc9a9a7025224d837d6b0272cf84c4377de57218 100644 (file)
@@ -9,6 +9,18 @@
     // a service where scales are registered with their respective charts so that changing the 
     // scales does not require 
     Chart.scaleService = {
+        // Scale registration object. Extensions can register new scale types (such as log or DB scales) and then
+        // use the new chart options to grab the correct scale
+        constructors: {},
+        // Use a registration function so that we can move to an ES6 map when we no longer need to support
+        // old browsers
+        registerScaleType: function(type, scaleConstructor) {
+            this.constructors[type] = scaleConstructor;
+        },
+        getScaleConstructor: function(type) {
+            return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined;
+        },
+
         // The interesting function
         fitScalesForChart: function(chartInstance, width, height) {
             var xPadding = width > 30 ? 5 : 2;
             }
         }
     };
-
-    // Scale registration object. Extensions can register new scale types (such as log or DB scales) and then
-    // use the new chart options to grab the correct scale
-    Chart.scales = {
-        constructors: {},
-        // Use a registration function so that we can move to an ES6 map when we no longer need to support
-        // old browsers
-        registerScaleType: function(type, scaleConstructor) {
-            this.constructors[type] = scaleConstructor;
-        },
-        getScaleConstructor: function(type) {
-            return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined;
-        }
-    };
-
 }).call(this);
index 9ce5e00f4b98dc1470c25bf9b1492509ff2eea45..7ed54613ec918ad3b8899116b6307fa838d37a83 100644 (file)
                        }
                }
        });
-       Chart.scales.registerScaleType("category", DatasetScale);
-
-
-
+       Chart.scaleService.registerScaleType("category", DatasetScale);
 }).call(this);
index 11e1bdfc247aabeab7893d7fc570d262d4c184d0..fd4e6d80034c0f155896c93bcfd265c5e44b7196 100644 (file)
                        }
                }
        });
-       Chart.scales.registerScaleType("linear", LinearScale);
-
-
+       Chart.scaleService.registerScaleType("linear", LinearScale);
+       
 }).call(this);
index 7bcda29c942d976dc8b58f67d3f0105c30600814..9d8e30eff45cc0474a85889607eb2cb061f2f597 100644 (file)
                        }
                }
        });
-       Chart.scales.registerScaleType("radialLinear", LinearRadialScale);
+       Chart.scaleService.registerScaleType("radialLinear", LinearRadialScale);
 
 
 }).call(this);