Browse Source

Change data api interface

pull/590/head
Masayuki Tanaka 10 years ago
parent
commit
03fb330105
  1. 15
      c3.js
  2. 2
      c3.min.js
  3. 13
      src/api.data.js

15
c3.js

@ -5967,14 +5967,13 @@
return config.regions;
};
c3_chart_fn.data = function () {};
c3_chart_fn.data.get = function (targetId) {
var target = this.data.getAsTarget(targetId);
return isDefined(target) ? target.values.map(function (d) { return d.value; }) : undefined;
};
c3_chart_fn.data.getAsTarget = function (targetId) {
var targets = this.data.targets.filter(function (t) { return t.id === targetId; });
return targets.length > 0 ? targets[0] : undefined;
c3_chart_fn.data = function (targetId) {
var targets = this.internal.data.targets.filter(function (t) { return t.id === targetId; });
return targets.length > 0 ? targets[0] : null;
};
c3_chart_fn.data.values = function (targetId) {
var target = this.data(targetId);
return target ? target.values.map(function (d) { return d.value; }) : null;
};
c3_chart_fn.data.names = function (names) {
var $$ = this.internal, config = $$.config;

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

13
src/api.data.js

@ -1,11 +1,10 @@
c3_chart_fn.data = function () {};
c3_chart_fn.data.get = function (targetId) {
var target = this.data.getAsTarget(targetId);
return isDefined(target) ? target.values.map(function (d) { return d.value; }) : undefined;
c3_chart_fn.data = function (targetId) {
var targets = this.internal.data.targets.filter(function (t) { return t.id === targetId; });
return targets.length > 0 ? targets[0] : null;
};
c3_chart_fn.data.getAsTarget = function (targetId) {
var targets = this.data.targets.filter(function (t) { return t.id === targetId; });
return targets.length > 0 ? targets[0] : undefined;
c3_chart_fn.data.values = function (targetId) {
var target = this.data(targetId);
return target ? target.values.map(function (d) { return d.value; }) : null;
};
c3_chart_fn.data.names = function (names) {
var $$ = this.internal, config = $$.config;

Loading…
Cancel
Save