【发布时间】:2013-07-17 19:16:47
【问题描述】:
我用的是nvd3.js离散条http://nvd3.org/ghpages/discreteBar.html
我正在检查代码,发现颜色是内联派生的
style="fill: #ffbb78; stroke: #ffbb78;"
我还跟踪了discreteBarChart函数
color = nv.utils.getColor()
我没有意识到和问的是颜色作为参数是什么?
【问题讨论】:
标签: nvd3.js
我用的是nvd3.js离散条http://nvd3.org/ghpages/discreteBar.html
我正在检查代码,发现颜色是内联派生的
style="fill: #ffbb78; stroke: #ffbb78;"
我还跟踪了discreteBarChart函数
color = nv.utils.getColor()
我没有意识到和问的是颜色作为参数是什么?
【问题讨论】:
标签: nvd3.js
如果你想使用一种单一的颜色,那么它可以从选项对象中返回,如下所示:
var options={
....
colour:function(){
return '#ff0000';
},
...
..
}
【讨论】: