|
|
|
@ -3672,14 +3672,16 @@
|
|
|
|
|
/*-- Draw Legend --*/ |
|
|
|
|
|
|
|
|
|
function opacityForLegend(id) { |
|
|
|
|
return d3.select(selectorLegend(id)).classed(CLASS.legendItemHidden) ? 0.5 : 1; |
|
|
|
|
var item = legend.select(selectorLegend(id)); |
|
|
|
|
item.style('opacity', null); // MEMO: remove to get opacity by css
|
|
|
|
|
return item.classed(CLASS.legendItemHidden) ? item.style('opacity') : 1; |
|
|
|
|
} |
|
|
|
|
function toggleFocusLegend(id, focus) { |
|
|
|
|
var legendItem = legend.selectAll('.' + CLASS.legendItem), |
|
|
|
|
var items = legend.selectAll('.' + CLASS.legendItem).filter(function () { return !d3.select(this).classed(CLASS.legendItemHidden); }), |
|
|
|
|
isTarget = function (d) { return (!id || d === id); }, |
|
|
|
|
notTarget = function (d) { return !isTarget(d); }; |
|
|
|
|
legendItem.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); |
|
|
|
|
legendItem.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); |
|
|
|
|
items.filter(notTarget).transition().duration(100).style('opacity', focus ? 0.3 : opacityForLegend); |
|
|
|
|
items.filter(isTarget).transition().duration(100).style('opacity', focus ? opacityForLegend : 0.3); |
|
|
|
|
} |
|
|
|
|
function focusLegend(id) { |
|
|
|
|
toggleFocusLegend(id, true); |
|
|
|
@ -3943,9 +3945,7 @@
|
|
|
|
|
showLegend(targetIds); |
|
|
|
|
} else { |
|
|
|
|
legend.selectAll(selectorLegends(targetIds)) |
|
|
|
|
.classed(CLASS.legendItemHidden, false) |
|
|
|
|
.transition() |
|
|
|
|
.style('opacity', 1); |
|
|
|
|
.classed(CLASS.legendItemHidden, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); |
|
|
|
@ -3964,9 +3964,7 @@
|
|
|
|
|
hideLegend(targetIds); |
|
|
|
|
} else { |
|
|
|
|
legend.selectAll(selectorLegends(targetIds)) |
|
|
|
|
.classed(CLASS.legendItemHidden, true) |
|
|
|
|
.transition() |
|
|
|
|
.style('opacity', 0.5); |
|
|
|
|
.classed(CLASS.legendItemHidden, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withTransitionForHorizontalAxis: false}); |
|
|
|
|