From c8d07b9578cc765c4364854562e7bc6fbf5c656a Mon Sep 17 00:00:00 2001 From: Andy Dufilie Date: Thu, 18 Feb 2016 18:09:41 -0500 Subject: [PATCH] gh-1583 added config.interaction.brighten option to disable brightening of selected path elements --- src/config.js | 1 + src/selection.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/config.js b/src/config.js index 6d54b23..aa6e57a 100644 --- a/src/config.js +++ b/src/config.js @@ -18,6 +18,7 @@ c3_chart_internal_fn.getDefaultConfig = function () { zoom_onzoomend: function () {}, zoom_x_min: undefined, zoom_x_max: undefined, + interaction_brighten: true, interaction_enabled: true, onmouseover: function () {}, onmouseout: function () {}, diff --git a/src/selection.js b/src/selection.js index e538763..b71d286 100644 --- a/src/selection.js +++ b/src/selection.js @@ -30,14 +30,18 @@ c3_chart_internal_fn.togglePoint = function (selected, target, d, i) { c3_chart_internal_fn.selectPath = function (target, d) { var $$ = this; $$.config.data_onselected.call($$, d, target.node()); - target.transition().duration(100) - .style("fill", function () { return $$.d3.rgb($$.color(d)).brighter(0.75); }); + if ($$.config.interaction_brighten) { + target.transition().duration(100) + .style("fill", function () { return $$.d3.rgb($$.color(d)).brighter(0.75); }); + } }; c3_chart_internal_fn.unselectPath = function (target, d) { var $$ = this; $$.config.data_onunselected.call($$, d, target.node()); - target.transition().duration(100) - .style("fill", function () { return $$.color(d); }); + if ($$.config.interaction_brighten) { + target.transition().duration(100) + .style("fill", function () { return $$.color(d); }); + } }; c3_chart_internal_fn.togglePath = function (selected, target, d, i) { selected ? this.selectPath(target, d, i) : this.unselectPath(target, d, i);