C3 stacked chart maintain data order

血红的双手。 提交于 2019-12-04 22:02:47

Turns out this is a known issue. If any one of the headers is an integer (or a string that is an integer), then c3 will sort the columns.

To work around I'm appending a space to the end of the column names so c3 interprets them as a string and not a number.

eg

chartOptions['data']['rows'][0] = ["0-1","2-3","4-5",
                                   "6 ", "7 "]; // Spaces appended to these
chartOptions['data']["groups"] = [["0-1","2-3","4-5","6 ", "7 "]];

I've updated the jsfiddle with the workaround.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!