Commit 4c6e2a99 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Accept multiple args in xgrids/ygrids.remove API

parent c81f5a29
......@@ -4655,15 +4655,20 @@
function isArc(d) {
return 'data' in d && hasTarget(c3.data.targets, d.data.id);
}
function getGridFilter(params) {
params = params || {};
return function (line) {
return !(('value' in params && line.value === params.value) || ('class' in params && line.class === params.class));
};
function getGridFilterToRemove(params) {
return params ? function (line) {
var found = false;
[].concat(params).forEach(function (param) {
if ((('value' in param && line.value === params.value) || ('class' in param && line.class === params.class))) {
found = true;
}
});
return found;
} : function () { return true; };
}
function removeGridLines(params, forX) {
var toShow = getGridFilter(params),
toRemove = function (line) { return !toShow(line); },
var toRemove = getGridFilterToRemove(params),
toShow = function (line) { return !toRemove(line); },
classLines = forX ? CLASS.xgridLines : CLASS.ygridLines,
classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;
main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove)
......
......@@ -44,6 +44,19 @@
setTimeout(function () {
chart.xgrids.remove({class:'hoge'});
}, 5000);
setTimeout(function () {
chart.xgrids.remove([{value: 1}, {value: 4}]);
}, 6000);
setTimeout(function () {
chart.xgrids([{value: 1, text:'Label 1'}, {value: 4, text: 'Label 4'}]);
}, 7000);
setTimeout(function () {
chart.xgrids.remove();
}, 8000);
</script>
</body>
</html>
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