Dav*_*bak 7 javascript charts google-visualization
是否可以在Google chart api中更改点颜色,如下所示:
由此:

对此: 
谢谢!
试着看看asgallant 在这里创建的这个jsFiddle示例
" 在API中没有支持使线条和数据点在同一系列中具有不同的颜色.但是,你可以伪装你想要的东西,使用DataView,你的数据重复两列.让第一个系列着色为黑色'和第二个颜色'红色',lineWidth = 0,pointSize> 0."
从示例:
var options = {
title: 'Load vs Length',
titlePosition: 'out',
legend: {
position: 'none'
},
hAxis: {
title: 'Length (inch)',
viewWindow: {
min: 0
},
format: '#.000'
},
vAxis: {
title: 'Load (pound)',
viewWindow: {
min: 0
}
},
series: { //Create 2 separate series to fake what you want. One for the line and one for the points
0: {
color: 'black',
lineWidth: 2
},
1: {
color: 'red',
lineWidth: 0,
pointSize: 5
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的建议.但是,系列1对我不起作用:遵循代码,打印蓝线但不显示点.如果我切换1和0.那么它确实显示红色的点,但没有线.在没有系列之前,我刚刚使用了pointSize:4,就在hAxis之后.这是有效的,除了点和相同颜色的线.
{title: 'progress',
vAxis: {
title: 'Grade',
titleTextStyle: {color: 'red'},
gridlines: {count: 7},
viewWindow: { min: 0,
max: 100,
valueLabelsInterval: 20}
},
hAxis: {
title: 'Q date',
titleTextStyle: {color: 'red'},
slantedText: true
},
series: {
0: {lineWidth: 2},
1: {
color: 'red',
lineWidth: 0,
pointSize: 4
}
}
}
Run Code Online (Sandbox Code Playgroud)