Browse Source

Merge pull request #1209 from jamesgarfield/bug/1208_Legend_Method_Customization

Change legend method customization to be consistent across all methods
pull/1220/merge
Masayuki Tanaka 10 years ago
parent
commit
d012676101
  1. 16
      src/legend.js

16
src/legend.js

@ -240,20 +240,24 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
} }
}) })
.on('mouseover', function (id) { .on('mouseover', function (id) {
$$.d3.select(this).classed(CLASS.legendItemFocused, true);
if (!$$.transiting && $$.isTargetToShow(id)) {
$$.api.focus(id);
}
if (config.legend_item_onmouseover) { if (config.legend_item_onmouseover) {
config.legend_item_onmouseover.call($$, id); config.legend_item_onmouseover.call($$, id);
} }
else {
$$.d3.select(this).classed(CLASS.legendItemFocused, true);
if (!$$.transiting && $$.isTargetToShow(id)) {
$$.api.focus(id);
}
}
}) })
.on('mouseout', function (id) { .on('mouseout', function (id) {
$$.d3.select(this).classed(CLASS.legendItemFocused, false);
$$.api.revert();
if (config.legend_item_onmouseout) { if (config.legend_item_onmouseout) {
config.legend_item_onmouseout.call($$, id); config.legend_item_onmouseout.call($$, id);
} }
else {
$$.d3.select(this).classed(CLASS.legendItemFocused, false);
$$.api.revert();
}
}); });
l.append('text') l.append('text')
.text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; }) .text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; })

Loading…
Cancel
Save