You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
c3_chart_fn.load = function (args) {
|
|
|
|
var $$ = this.internal, config = $$.config;
|
|
|
|
// update xs if specified
|
|
|
|
if (args.xs) {
|
|
|
|
$$.addXs(args.xs);
|
|
|
|
}
|
|
|
|
// update classes if exists
|
|
|
|
if ('classes' in args) {
|
|
|
|
Object.keys(args.classes).forEach(function (id) {
|
|
|
|
config.data_classes[id] = args.classes[id];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// update categories if exists
|
|
|
|
if ('categories' in args && $$.isCategorized()) {
|
|
|
|
config.axis_x_categories = args.categories;
|
|
|
|
}
|
|
|
|
// use cache if exists
|
|
|
|
if ('cacheIds' in args && $$.hasCaches(args.cacheIds)) {
|
|
|
|
$$.load($$.getCaches(args.cacheIds), args.done);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// unload if needed
|
|
|
|
if ('unload' in args) {
|
|
|
|
// TODO: do not unload if target will load (included in url/rows/columns)
|
|
|
|
$$.unload($$.mapToTargetIds((typeof args.unload === 'boolean' && args.unload) ? null : args.unload), function () {
|
|
|
|
$$.loadFromArgs(args);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$$.loadFromArgs(args);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
c3_chart_fn.unload = function (args) {
|
|
|
|
var $$ = this.internal;
|
|
|
|
args = args || {};
|
|
|
|
$$.unload($$.mapToTargetIds(args.ids), function () {
|
|
|
|
$$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});
|
|
|
|
if (args.done) { args.done(); }
|
|
|
|
});
|
|
|
|
};
|