Browse Source

Update x domain when unload in load API - #342

pull/373/merge
Masayuki Tanaka 11 years ago
parent
commit
48e29ac59e
  1. 43
      c3.js
  2. 2
      c3.min.js
  3. 1
      htdocs/samples/data_load.html

43
c3.js

@ -4446,27 +4446,29 @@
}
function load(targets, args) {
// filter loading targets if needed
if (args.filter) {
targets = targets.filter(args.filter);
}
// set type if args.types || args.type specified
if (args.type || args.types) {
targets.forEach(function (t) {
args.types ? setTargetType(t.id, args.types[t.id]) : setTargetType(t.id, args.type);
if (targets) {
// filter loading targets if needed
if (args.filter) {
targets = targets.filter(args.filter);
}
// set type if args.types || args.type specified
if (args.type || args.types) {
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
updateTargets(c3.data.targets);
@ -4496,6 +4498,9 @@
else if (args.columns) {
load(convertDataToTargets(convertColumnsToData(args.columns)), args);
}
else {
load(null, args);
}
}
function unload(targetIds, done) {

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

1
htdocs/samples/data_load.html

@ -47,6 +47,7 @@
[120, 160, 230],
[80, 130, 300],
[90, 220, 320],
[1090, 1220, 1320],
]
});
},

Loading…
Cancel
Save