]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fixed unit tests :D
authorBlake Niemyjski <bniemyjski@gmail.com>
Sat, 14 May 2016 03:39:11 +0000 (22:39 -0500)
committerBlake Niemyjski <bniemyjski@gmail.com>
Sat, 14 May 2016 03:39:11 +0000 (22:39 -0500)
src/controllers/controller.bar.js
src/core/core.controller.js
src/core/core.scale.js
src/scales/scale.radialLinear.js

index 35d1f5925c377b9b908362214dead4b91e572588..328b96ff6a1fc7631ca8c06bd85564f51b8b3c63 100644 (file)
@@ -398,6 +398,9 @@ module.exports = function(Chart) {
                                xScalePoint = xScale.getPixelForValue(0);
                        }
 
+                       var custom = rectangle.custom;
+                       var dataset = this.getDataset();
+                       var rectangleElementOptions = this.chart.options.elements.rectangle;
                        helpers.extend(rectangle, {
                                // Utility
                                _chart: this.chart.chart,
@@ -413,15 +416,15 @@ module.exports = function(Chart) {
 
                                        // Tooltip
                                        label: this.chart.data.labels[index],
-                                       datasetLabel: this.getDataset().label,
+                                       datasetLabel: dataset.label,
 
                                        // Appearance
                                        base: reset ? xScalePoint : this.calculateBarBase(this.index, index),
                                        height: this.calculateBarHeight(numBars),
-                                       backgroundColor: customr && customr.backgroundColor ? customr.backgroundColor : helpers.getValueAtIndexOrDefault(this.getDataset().backgroundColor, index, this.chart.options.elements.rectangle.backgroundColor),
-                                       borderSkipped: customr && customr.borderSkipped ? customr.borderSkipped : this.chart.options.elements.rectangle.borderSkipped,
-                                       borderColor: customr && customr.borderColor ? customr.borderColor : helpers.getValueAtIndexOrDefault(this.getDataset().borderColor, index, this.chart.options.elements.rectangle.borderColor),
-                                       borderWidth: customr && customr.borderWidth ? customr.borderWidth : helpers.getValueAtIndexOrDefault(this.getDataset().borderWidth, index, this.chart.options.elements.rectangle.borderWidth)
+                                       backgroundColor: custom && custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor),
+                                       borderSkipped: custom && custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped,
+                                       borderColor: custom && custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor),
+                                       borderWidth: custom && custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth)
                                },
 
                                draw: function () {
index ca38642cb757d4f75c298a17bf82b5f39ba23b6b..439cce27df1f932c437d238b2b4c71067659f61d 100644 (file)
@@ -540,15 +540,16 @@ module.exports = function(Chart) {
 
                        // Remove styling for last active (even if it may still be active)
                        if (this.lastActive.length) {
+                               var lastActive;
                                switch (this.options.hover.mode) {
                                        case 'single':
-                                               var lastActive = this.lastActive[0];
+                                               lastActive = this.lastActive[0];
                                                this.getDatasetMeta(lastActive._datasetIndex).controller.removeHoverStyle(lastActive, lastActive._datasetIndex, lastActive._index);
                                                break;
                                        case 'label':
                                        case 'dataset':
                                                for (var i = 0; i < this.lastActive.length; i++) {
-                                                       var lastActive = this.lastActive[i];
+                                                       lastActive = this.lastActive[i];
                                                        if (lastActive)
                                                                this.getDatasetMeta(lastActive._datasetIndex).controller.removeHoverStyle(lastActive, lastActive._datasetIndex, lastActive._index);
                                                }
@@ -560,15 +561,16 @@ module.exports = function(Chart) {
 
                        // Built in hover styling
                        if (this.active.length && this.options.hover.mode) {
+                               var active;
                                switch (this.options.hover.mode) {
                                        case 'single':
-                                               var active = this.active[0];
+                                               active = this.active[0];
                                                this.getDatasetMeta(active._datasetIndex).controller.setHoverStyle(active);
                                                break;
                                        case 'label':
                                        case 'dataset':
                                                for (var j = 0; j < this.active.length; j++) {
-                                                       var active = this.active[j];
+                                                       active = this.active[j];
                                                        if (active)
                                                                this.getDatasetMeta(active._datasetIndex).controller.setHoverStyle(active);
                                                }
index 41a754a397dff355d5dcc444f53b6c367af0f660..9802995dac2f89b443ff9ef6f8bad92ce2393db6 100644 (file)
@@ -265,6 +265,7 @@ module.exports = function(Chart) {
                        };
 
                        var opts = this.options;
+                       var globalDefaults = Chart.defaults.global;
                        var tickOpts = opts.ticks;
                        var scaleLabelOpts = opts.scaleLabel;
                        var display = opts.display;
@@ -463,7 +464,7 @@ module.exports = function(Chart) {
                                var skipRatio;
                                var scaleLabelX;
                                var scaleLabelY;
-]                              var useAutoskipper = optionTicks.autoSkip;
+                               var useAutoskipper = optionTicks.autoSkip;
 
                                // figure out the maximum number of gridlines to show
                                var maxTicks;
index ef6d3b60787d71e165d99c94220af5f904d97d33..5d46f26ee0d954c751442fc98246046e14651fe0 100644 (file)
@@ -3,7 +3,7 @@
 module.exports = function(Chart) {
 
        var helpers = Chart.helpers;
-       var globalDefaults = globalDefaults;
+       var globalDefaults = Chart.defaults.global;
 
        var defaultConfig = {
                display: true,