diff --git a/src/legend.js b/src/legend.js index dcb4cdf..68f2f05 100644 --- a/src/legend.js +++ b/src/legend.js @@ -240,20 +240,24 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) { } }) .on('mouseover', function (id) { - $$.d3.select(this).classed(CLASS.legendItemFocused, true); - if (!$$.transiting && $$.isTargetToShow(id)) { - $$.api.focus(id); - } if (config.legend_item_onmouseover) { 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) { - $$.d3.select(this).classed(CLASS.legendItemFocused, false); - $$.api.revert(); if (config.legend_item_onmouseout) { config.legend_item_onmouseout.call($$, id); } + else { + $$.d3.select(this).classed(CLASS.legendItemFocused, false); + $$.api.revert(); + } }); l.append('text') .text(function (id) { return isDefined(config.data_names[id]) ? config.data_names[id] : id; })