Commit 84a469e2 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix class for focused legend

parent 88ac4618
...@@ -63,14 +63,11 @@ c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) { ...@@ -63,14 +63,11 @@ c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) {
c3_chart_internal_fn.toggleFocusLegend = function (id, focus) { c3_chart_internal_fn.toggleFocusLegend = function (id, focus) {
var $$ = this; var $$ = this;
$$.legend.selectAll('.' + CLASS.legendItem) $$.legend.selectAll('.' + CLASS.legendItem)
.classed(CLASS.legendItemFocused, function (_id) { return id === _id && focus; })
.transition().duration(100) .transition().duration(100)
.style('opacity', function (_id) { .style('opacity', function (_id) {
var This = $$.d3.select(this); var opacity = id === _id && focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend;
if (id && _id !== id) { return opacity($$.d3.select(this));
return focus ? $$.opacityForUnfocusedLegend(This) : $$.opacityForLegend(This);
} else {
return focus ? $$.opacityForLegend(This) : $$.opacityForUnfocusedLegend(This);
}
}); });
}; };
c3_chart_internal_fn.revertLegend = function () { c3_chart_internal_fn.revertLegend = function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment