2

I have a C3 stacked bar chart. In that I am facing an issue. I am plotting 3 values in stack. P1, P2 and Other. If all suppose I dont have value for P2, then my order will change in some random manner.

enter image description here

See for the second bar P2 is coming on top and P1 is coming below that.

I tried hard coding the 0 to 1, I am getting the correct order.

enter image description here

How can I correct the order even if some values are zero?

  • I checked this https://stackoverflow.com/questions/40911095/c3-stacked-chart-maintain-data-order. But this is not the reason. I am not using the integer column names. – Jyothish Bhaskaran Feb 26 '18 at 13:22

1 Answers1

1

Did you check the data order? I think you will find your answer here.

You can specify desc, asc or function (data1, data2) { ... } to specify the order for the data, null being the order the data loaded.

Please find a working example here.

Sala
  • 335
  • 3
  • 17