Commit 48e29ac5 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Update x domain when unload in load API - #342

parent 887ebcc8
...@@ -4446,27 +4446,29 @@ ...@@ -4446,27 +4446,29 @@
} }
function load(targets, args) { function load(targets, args) {
// filter loading targets if needed if (targets) {
if (args.filter) { // filter loading targets if needed
targets = targets.filter(args.filter); if (args.filter) {
} targets = targets.filter(args.filter);
// set type if args.types || args.type specified }
if (args.type || args.types) { // set type if args.types || args.type specified
targets.forEach(function (t) { if (args.type || args.types) {
args.types ? setTargetType(t.id, args.types[t.id]) : setTargetType(t.id, args.type); targets.forEach(function (t) {
args.types ? setTargetType(t.id, args.types[t.id]) : setTargetType(t.id, args.type);
});
}
// Update/Add data
c3.data.targets.forEach(function (d) {
for (var i = 0; i < targets.length; i++) {
if (d.id === targets[i].id) {
d.values = targets[i].values;
targets.splice(i, 1);
break;
}
}
}); });
c3.data.targets = c3.data.targets.concat(targets); // add remained
} }
// Update/Add data
c3.data.targets.forEach(function (d) {
for (var i = 0; i < targets.length; i++) {
if (d.id === targets[i].id) {
d.values = targets[i].values;
targets.splice(i, 1);
break;
}
}
});
c3.data.targets = c3.data.targets.concat(targets); // add remained
// Set targets // Set targets
updateTargets(c3.data.targets); updateTargets(c3.data.targets);
...@@ -4496,6 +4498,9 @@ ...@@ -4496,6 +4498,9 @@
else if (args.columns) { else if (args.columns) {
load(convertDataToTargets(convertColumnsToData(args.columns)), args); load(convertDataToTargets(convertColumnsToData(args.columns)), args);
} }
else {
load(null, args);
}
} }
function unload(targetIds, done) { function unload(targetIds, done) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
[120, 160, 230], [120, 160, 230],
[80, 130, 300], [80, 130, 300],
[90, 220, 320], [90, 220, 320],
[1090, 1220, 1320],
] ]
}); });
}, },
......
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