Browse Source

Fix x/xs API

pull/104/head
Masayuki Tanaka 11 years ago
parent
commit
951a78ac84
  1. 8
      c3.js
  2. 2
      c3.min.js
  3. 6
      htdocs/samples/custom_xs_scale.html

8
c3.js

@ -1237,7 +1237,7 @@
function updateTargetX(targets, x) {
targets.forEach(function (t) {
t.values.filter(function (v) { return v.value !== null; }).forEach(function (v, i) {
t.values.forEach(function (v, i) {
v.x = generateTargetX(x[i], t.id, i);
});
c3.data.x[t.id] = x;
@ -1328,8 +1328,12 @@
if (i === 0) { __axis_x_categories = []; }
__axis_x_categories.push(rawX);
}
// mark as x = undefined if value is undefined and filter to remove after mapped
if (typeof d[id] === 'undefined') {
x = undefined;
}
return {x: x, value: d[id] !== null && !isNaN(d[id]) ? +d[id] : null, id: convertedId};
})
}).filter(function (v) { return typeof v.x !== 'undefined'; })
};
});

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

6
htdocs/samples/custom_xs_scale.html

@ -32,7 +32,7 @@
setTimeout(function () {
chart.load({
columns: [
['data1', 100, 210, 150, 200, 100, 150],
['data1', 100, 210, 150, 200, null, 150],
['data2', 200, 310, 50, 400, 120, 250, 10],
]
});
@ -40,8 +40,8 @@
setTimeout(function () {
chart.xs({
// 'data1': [200, 210, 350, 400, 550, 750]
'data2': [200, 210, 350, 400, 550, 750, 900]
'data1': [200, 210, 350, 400, 600, 750]
// 'data2': [200, 210, 350, 400, 550, 750, 900]
});
}, 2000);
</script>

Loading…
Cancel
Save