Charts 谷歌图表:全局点笔划颜色
正在尝试在chartkick中设置全局笔划颜色Charts 谷歌图表:全局点笔划颜色,charts,google-visualization,Charts,Google Visualization,正在尝试在chartkick中设置全局笔划颜色 'point { size: 18; stroke-color: #F00; }' 但似乎没有任何变化允许全局配置: pointStrokeColor: '#F00', style: 'point { stroke-color: #F00; }', point: {strokeColor: '#F00', stroke: {color: '#F00'}} google.charts.load('current',{'packages':['c
'point { size: 18; stroke-color: #F00; }'
但似乎没有任何变化允许全局配置:
pointStrokeColor: '#F00',
style: 'point { stroke-color: #F00; }',
point: {strokeColor: '#F00', stroke: {color: '#F00'}}
google.charts.load('current',{'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
函数绘图图(){
var data=google.visualization.arrayToDataTable
([['X','Y',{'type':'string','role':'style'}),
[1,6,null],
[2,5,'点{size:18;笔划颜色:#F00;}'],
[3,4,null]
]);
变量选项={
curveType:'函数',
点数:10,
pointStrokeColor:“#F00”,
样式:“点{笔划颜色:#F00;}”,
点:{strokeColor:'#F00',笔划:{color:'#F00'}
};
var chart=new google.visualization.LineChart(document.getElementById('chart_div'));
图表绘制(数据、选项);
}
更改点笔划颜色的唯一标准方法是使用
必须在每个点上设置列角色
可以使用设置所有行的样式
var view = new google.visualization.DataView(data);
view.setColumns([0, 1, {
calc: function (dt, row) {
return 'point {stroke-color: #F00;}';
},
role: 'style',
type: 'string'
}]);
请参阅以下工作片段
google.charts.load('current'{
回调:图纸,
软件包:['corechart']
});
函数绘图图(){
var data=google.visualization.arrayToDataTable([
['X','Y'],
[1, 6],
[2, 5],
[3, 4]
]);
var view=newgoogle.visualization.DataView(数据);
view.setColumns([0,1,1{
计算:函数(dt,行){
返回'point{stroke color:#F00;}';
},
角色:'风格',
键入:“字符串”
}]);
变量选项={
curveType:'函数',
点数:10
};
var chart=new google.visualization.LineChart(document.getElementById('chart_div'));
//使用视图绘制图表
图表绘制(视图、选项);
}