javascript 没有设置填充颜色的chart.js条形图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24623568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
chart.js barchart without set fill color
提问by oki
This is my first time using Chart.js and I want to create bar chart with multiple series. Based on documentation we have to specify fillColor for each dataset. Is that possible to create multiple chart without set fillColor (like barchart in excel).
这是我第一次使用 Chart.js,我想创建多个系列的条形图。根据文档,我们必须为每个数据集指定 fillColor。是否可以在不设置 fillColor 的情况下创建多个图表(如 Excel 中的条形图)。
回答by w1n78
fillColor uses rgba. a = alpha. you can set alpha value to 0. such as
fillColor 使用 rgba。a = 阿尔法。您可以将 alpha 值设置为 0。例如
fillColor: "rgba(220,220,220,0)"
this should give it a transparent fill color and still display the border colors assuming you have them not transparent.
这应该给它一个透明的填充颜色,并且仍然显示边框颜色,假设你有它们不透明。
回答by User-8017771
I know its very late, but we can achieve empty bar chart with only the border visible by setting the property : fill:false
我知道它很晚了,但是我们可以通过设置属性来实现只有边框可见的空条形图: fill:false
Hope it helps someone :)
希望它可以帮助某人:)