i need to sort stacked bar chart in each category by value so for the following code:
var chart = c3.generate({
data: {
columns: [
['data1', 100, 400, 500, 800, 900],
['data2', 200, 300, 600, 700, 1000]
],
type: 'bar',
groups: [
['data1', 'data2']
]
},
axis: {
x: {
type: "category",
categories: ['c1', 'c2', 'c3', 'c4', 'c5']
}
},
grid: {
y: {
lines: [{value:0}]
}
}
});
in category c1 i want to see data1 under data2 (because 100 < 200) but in category c2 i want to see data2 under data1 (because 400 > 300). the c3 data order property is only making the sort based on the sum over all the categories.
the graph before sort looks like: unsorted graph
desired sort: sorted graph per category by value