Load data bug with categorized axis
Hi,
If you try to add more data to existing chart with categorized X type, it will fail to do that correctly. Only one newly added value is rendered to chart, all the others are invisible (but rects are added to the DOM). It seems that X scale is calculated incorrectly.
Please take a look at the sample below:
$(function(){
var chart = c3.generate({
bindto:"#chart1",
data: {
x: "x",
columns: [
["x", "A", "B", "C"],
['data1', 130, 120, 150],
['data4', 30, 20, 50]
],
type: 'bar'
},
axis: {
x: {
type: 'categorized'
}
},
});
setTimeout(function () {
chart.load({
columns: [
["x", "A", "B", "C", "D", "E", "F", "G", "H"],
['data1', 130, 120, 150, 140, 160, 150, 200, 300],
['data4', 30, 20, 50, 40, 60, 50, 100, 120]
]
});
}, 2000);
});
I tested that loading of data works ok with default 'indexed' X type and timeseries type. In the example of categorized charts there is a loading function placed in timer, but only one more data value is added . Hence this bug is not visible there.
I think I found a way to fix it, created a pull request
Hi, Thank you for working on this. The pull request seems working well and I'll merge soon. Thank you!