]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Updated magnification and possible bug fix in removeHoverStyle
authorBlake Niemyjski <bniemyjski@gmail.com>
Sat, 14 May 2016 03:16:28 +0000 (22:16 -0500)
committerBlake Niemyjski <bniemyjski@gmail.com>
Sat, 14 May 2016 03:16:28 +0000 (22:16 -0500)
.gitignore
src/controllers/controller.bar.js

index a3589d2914563743ff1185219922cca109d75bb4..a79806fdf77f81ffb48e223830d46ae13d4d3b31 100644 (file)
@@ -9,5 +9,5 @@ docs/index.md
 bower_components/
 
 coverage/*
-
+.idea
 nbproject/*
index bf3e50b3ddd67881cf8ae0b0475e50c1d2bf74e4..35d1f5925c377b9b908362214dead4b91e572588 100644 (file)
@@ -304,18 +304,23 @@ module.exports = function(Chart) {
                        var dataset = this.chart.data.datasets[rectangle._datasetIndex];
                        var index = rectangle._index;
 
-                       rectangle._model.backgroundColor = customr && customr.hoverBackgroundColor ? customr.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(rectangle._model.backgroundColor));
-                       rectangle._model.borderColor = customr && customr.hoverBorderColor ? customr.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(rectangle._model.borderColor));
-                       rectangle._model.borderWidth = customr && customr.hoverBorderWidth ? customr.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.hoverBorderWidth, index, rectangle._model.borderWidth);
+                       var custom = rectangle.custom;
+                       var model = rectangle._model;
+                       model.backgroundColor = custom && custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
+                       model.borderColor = custom && custom.hoverBorderColor ? custom.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor));
+                       model.borderWidth = custom && custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth);
                },
 
                removeHoverStyle: function(rectangle) {
                        var dataset = this.chart.data.datasets[rectangle._datasetIndex];
                        var index = rectangle._index;
+                       var custom = rectangle.custom;
+                       var model = rectangle._model;
+                       var rectangleElementOptions = this.chart.options.elements.rectangle;
 
-                       rectangle._model.backgroundColor = customr && customr.backgroundColor ? customr.backgroundColor : helpers.getValueAtIndexOrDefault(this.getDataset().backgroundColor, index, this.chart.options.elements.rectangle.backgroundColor);
-                       rectangle._model.borderColor = customr && customr.borderColor ? customr.borderColor : helpers.getValueAtIndexOrDefault(this.getDataset().borderColor, index, this.chart.options.elements.rectangle.borderColor);
-                       rectangle._model.borderWidth = customr && customr.borderWidth ? customr.borderWidth : helpers.getValueAtIndexOrDefault(this.getDataset().borderWidth, index, this.chart.options.elements.rectangle.borderWidth);
+                       model.backgroundColor = custom && custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor);
+                       model.borderColor = custom && custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor);
+                       model.borderWidth = custom && custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth);
                }
 
        });