Browse Source

Fix legend selector

pull/80/head 0.1.18
Masayuki Tanaka 11 years ago
parent
commit
2e6589fa3a
  1. 10
      c3.js
  2. 2
      c3.min.js

10
c3.js

@ -2891,21 +2891,21 @@
/*-- Draw Legend --*/
function focusLegend(id) {
var legendItem = svg.selectAll('.legend-item'),
var legendItem = legend.selectAll('.legend-item'),
isTarget = function (d) { return !id || d === id; },
notTarget = function (d) { return !isTarget(d); };
legendItem.filter(notTarget).transition().duration(100).style('opacity', 0.3);
legendItem.filter(isTarget).transition().duration(100).style('opacity', 1);
}
function defocusLegend(id) {
var legendItem = svg.selectAll('.legend-item'),
var legendItem = legend.selectAll('.legend-item'),
isTarget = function (d) { return !id || d === id; },
notTarget = function (d) { return !isTarget(d); };
legendItem.filter(notTarget).transition().duration(100).style('opacity', 1);
legendItem.filter(isTarget).transition().duration(100).style('opacity', 0.3);
}
function revertLegend() {
svg.selectAll('.legend-item')
legend.selectAll('.legend-item')
.transition().duration(100)
.style('opacity', 1);
}
@ -2997,11 +2997,9 @@
__legend_item_onclick(id);
})
.on('mouseover', function (id) {
focusLegend(id);
c3.focus(id);
})
.on('mouseout', function () {
revertLegend();
c3.revert();
});
l.append('text')
@ -3191,7 +3189,7 @@
.remove();
if (__legend_show) {
svg.selectAll('.legend-item' + getTargetSelectorSuffix(targetId)).remove();
legend.selectAll('.legend-item' + getTargetSelectorSuffix(targetId)).remove();
}
if (c3.data.targets.length > 0) {

2
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save