Browse Source

gh-1583 added config.interaction.brighten option to disable brightening of

selected path elements
pull/1675/head
Andy Dufilie 9 years ago committed by Ændrew Rininsland
parent
commit
c8d07b9578
No known key found for this signature in database
GPG Key ID: ADBCD4C867F9B2DA
  1. 1
      src/config.js
  2. 4
      src/selection.js

1
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 () {},

4
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());
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());
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);

Loading…
Cancel
Save