Commit 951a78ac authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix x/xs API

parent bd02e0f1
......@@ -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'; })
};
});
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment