Chart.js 堆叠和分组条形图 [英] Chart.js stacked and grouped bar chart
本文介绍了Chart.js 堆叠和分组条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法用 Chart.js 库做一个堆叠和分组的条形图?
is there any way to do a stacked and grouped bar chart with Chart.js library?
它应该看起来像这样 http://www.highcharts.com/演示/列堆叠和分组
推荐答案
你应该为每个数据集使用数据集对象的 stack 属性.
You should use the stack property of the dataset object for each dataset.
正如您在 Chart.js 文档中所见,堆栈定义为:
As you can see in Chart.js Documentation, stack is defined as:
此数据集所属的组的ID(堆叠时,每个组将是一个单独的堆叠)"
"The ID of the group to which this dataset belongs to (when stacked, each group will be a separate stack)"
我相信这个功能是最近推出的,2016 年 Chart.js 没有这个功能,因为 这篇文章
I believe this functionality has been introduced recently and in 2016 Chart.js did not have this because of this post
这篇关于Chart.js 堆叠和分组条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文