From 26d8c3e061d64b3c64d0092d221954741b95539d Mon Sep 17 00:00:00 2001 From: James Garfield Date: Wed, 10 Jun 2015 13:37:49 -0400 Subject: [PATCH] Change legend method customization/override to be consistent across all methods. --- src/legend.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/legend.js b/src/legend.js index eb92697..369b106 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; })