Quite good looking graph derived from d3.js http://c3js.org
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.

32 lines
1.1 KiB

c3_chart_fn.data = function (targetIds) {
var targets = this.internal.data.targets;
return typeof targetIds === 'undefined' ? targets : targets.filter(function (t) {
return [].concat(targetIds).indexOf(t.id) >= 0;
});
};
c3_chart_fn.data.shown = function (targetId) {
return this.internal.filterTargetsToShow(this.data(targetId));
11 years ago
};
c3_chart_fn.data.values = function (targetId) {
var target = this.data(targetId);
return target ? target.values.map(function (d) { return d.value; }) : null;
11 years ago
};
c3_chart_fn.data.names = function (names) {
var $$ = this.internal, config = $$.config;
if (!arguments.length) { return config.data_names; }
11 years ago
Object.keys(names).forEach(function (id) {
config.data_names[id] = names[id];
11 years ago
});
$$.redraw({withLegend: true});
return config.data_names;
11 years ago
};
c3_chart_fn.data.colors = function (colors) {
var $$ = this.internal, config = $$.config;
if (!arguments.length) { return config.data_colors; }
11 years ago
Object.keys(colors).forEach(function (id) {
config.data_colors[id] = colors[id];
11 years ago
});
$$.redraw({withLegend: true});
return config.data_colors;
11 years ago
};