]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Remove hover styles
authorEvert Timberg <evert.timberg@gmail.com>
Mon, 15 Jun 2015 23:10:47 +0000 (19:10 -0400)
committerEvert Timberg <evert.timberg@gmail.com>
Mon, 15 Jun 2015 23:10:47 +0000 (19:10 -0400)
src/controllers/controller.bar.js
src/controllers/controller.line.js

index 9ade928793006dbadbcf1064cb2c621efc9e7888..0bb92041d6926d7a00c482a14e058cf5ea895a53 100644 (file)
                        }, this);
                },
 
-
-
                setHoverStyle: function(rectangle) {
                        var dataset = this.chart.data.datasets[rectangle._datasetIndex];
                        var index = rectangle._index;
                },
 
                removeHoverStyle: function(rectangle) {
-                       // TODO
+                       var dataset = this.chart.data.datasets[rectangle._datasetIndex];
+                       var index = rectangle._index;
+
+                       rectangle._model.backgroundColor = rectangle.custom && rectangle.custom.backgroundColor ? rectangle.custom.backgroundColor : helpers.getValueAtIndexOrDefault(this.getDataset().backgroundColor, index, this.chart.options.elements.rectangle.backgroundColor);
+                       rectangle._model.borderColor = rectangle.custom && rectangle.custom.borderColor ? rectangle.custom.borderColor : helpers.getValueAtIndexOrDefault(this.getDataset().borderColor, index, this.chart.options.elements.rectangle.borderColor);
+                       rectangle._model.borderWidth = rectangle.custom && rectangle.custom.borderWidth ? rectangle.custom.borderWidth : helpers.getValueAtIndexOrDefault(this.getDataset().borderWidth, index, this.chart.options.elements.rectangle.borderWidth);
                }
 
        });
index c9fc366822f3d8b3fc9ca0bca19dd87bcb2fe8b8..79bc1c7822eb2ecad33de43d872dde57939576ab 100644 (file)
                },
 
                removeHoverStyle: function(point) {
-                       // TODO
+                       var dataset = this.chart.data.datasets[point._datasetIndex];
+                       var index = point._index;
+
+                       point._model.radius = point.custom && point.custom.radius ? point.custom.radius : helpers.getValueAtIndexOrDefault(this.getDataset().radius, index, this.chart.options.elements.point.radius);
+                       point._model.backgroundColor = point.custom && point.custom.backgroundColor ? point.custom.backgroundColor : helpers.getValueAtIndexOrDefault(this.getDataset().pointBackgroundColor, index, this.chart.options.elements.point.backgroundColor);
+                       point._model.borderColor = point.custom && point.custom.borderColor ? point.custom.borderColor : helpers.getValueAtIndexOrDefault(this.getDataset().pointBorderColor, index, this.chart.options.elements.point.borderColor);
+                       point._model.borderWidth = point.custom && point.custom.borderWidth ? point.custom.borderWidth : helpers.getValueAtIndexOrDefault(this.getDataset().pointBorderWidth, index, this.chart.options.elements.point.borderWidth);
                }
 
        });