From: Evert Timberg Date: Mon, 15 Jun 2015 23:10:47 +0000 (-0400) Subject: Remove hover styles X-Git-Tag: 2.0.0-alpha3~10^2~12^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b21061c164e265490fe3eb80df266cc62b334044;p=thirdparty%2FChart.js.git Remove hover styles --- diff --git a/src/controllers/controller.bar.js b/src/controllers/controller.bar.js index 9ade92879..0bb92041d 100644 --- a/src/controllers/controller.bar.js +++ b/src/controllers/controller.bar.js @@ -128,8 +128,6 @@ }, this); }, - - setHoverStyle: function(rectangle) { var dataset = this.chart.data.datasets[rectangle._datasetIndex]; var index = rectangle._index; @@ -140,7 +138,12 @@ }, 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); } }); diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index c9fc36682..79bc1c782 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -215,7 +215,13 @@ }, 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); } });