Browse Source

Support multiple unload

pull/110/head
Masayuki Tanaka 11 years ago
parent
commit
e8b7f734d4
  1. 32
      c3.js
  2. 4
      c3.min.js

32
c3.js

@ -3389,6 +3389,21 @@
done();
}
function unload(targetIds) {
targetIds.forEach(function (id) {
c3.data.targets = c3.data.targets.filter(function (t) {
return t.id !== id;
});
svg.selectAll(selectorTarget(id))
.transition()
.style('opacity', 0)
.remove();
if (__legend_show) {
legend.selectAll('.' + CLASS.legendItem + getTargetSelectorSuffix(id)).remove();
}
});
}
/*-- Draw Legend --*/
function toggleFocusLegend(id, focus) {
@ -3685,19 +3700,10 @@
}
};
c3.unload = function (targetId) {
c3.data.targets = c3.data.targets.filter(function (t) {
return t.id !== targetId;
});
svg.selectAll(selectorTarget(targetId))
.transition()
.style('opacity', 0)
.remove();
if (__legend_show) {
legend.selectAll('.' + CLASS.legendItem + getTargetSelectorSuffix(targetId)).remove();
}
c3.unload = function (targetIds) {
// remove elements for targetId
unload(typeof targetIds === 'string' ? [targetIds] : targetIds);
// try redraw if targets exist
if (c3.data.targets.length > 0) {
redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});
}

4
c3.min.js vendored

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