Browse Source

Add data.names API - #100

pull/104/head
Masayuki Tanaka 11 years ago
parent
commit
f1899271a8
  1. 7
      c3.js
  2. 2
      c3.min.js

7
c3.js

@ -3491,6 +3491,7 @@
legend.selectAll('text')
.data(ids)
.text(function (id) { return isDefined(__data_names[id]) ? __data_names[id] : id; }) // MEMO: needed for update
.each(function (id, i) { updatePositions(this, id, i === 0); })
.transition().duration(withTransition ? 250 : 0)
.attr('x', xForLegendText)
@ -3824,6 +3825,12 @@
var targets = getTargets(function (t) { return t.id === targetId; });
return targets.length > 0 ? targets[0] : undefined;
};
c3.data.names = function (names) {
if (!arguments.length) { return __data_names; }
__data_names = names;
updateLegend(c3.data.targets, {withTransition: true});
return __data_names;
};
c3.resize = function (size) {
__size_width = size ? size.width : null;

2
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save