nvd3.js - 无法更改折线图中线条的颜色 [英] nvd3.js - unable to change color of line in line chart
本文介绍了nvd3.js - 无法更改折线图中线条的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试更改nvd3折线图的不同行的颜色此处但我不能理解如何这样做。我想将示例中的两行的颜色更改为绿色和青色。我尝试了
I am trying to change the colors of different lines of the nvd3 line chart here but am unable to understand how to do so. I would like to change the colors of the 2 lines in the example to green and cyan. I tried
nv.addGraph(function() {
var chart = nv.models.lineChart()
.useInteractiveGuideline(true)
.color(["rgb(0,255,0)","rgb(255,165,0)"]);
}
它适用于散点图这里。但是折线图的颜色不会改变任何建议。
It worked for scatter chart here. But the color does not change for line chart. Any suggestions.
感谢
推荐答案
您可以使用这个!
return [
{
values: data, //values - represents the array of {x,y} data points
key: 'Money', //key - the name of the series.
color: '#33ccff' //color - optional: choose your own line color.
}
];
这篇关于nvd3.js - 无法更改折线图中线条的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文