我正在使用Google Charts API在webapp上包含各种图形我'm working on. I' m使用javascript图表工具( not 图像图表工具),我想知道是否可以在图表上使用透明背景(例如折线图,饼图等)?
在图表的“配置选项”中,指定
backgroundColor: { fill:'transparent' }
这适用于Chrome和Firefox . 我花了一些时间来find out . doc page表示你只能输入HTML颜色字符串,我认为'transparent'不是其中之一 .
Setting a transparent background for Google Charts:
// Set chart options var options = {'title':'Chart Title', 'width':600, 'height':300, 'backgroundColor': 'transparent', 'is3D':true };
JSFIDDLE DEMO
backgroundColor:“00000000”为我工作 .
如果没有任何作用,请尝试在drawChart()函数的末尾找到背景矩形并添加fill-opacity属性 .
fill-opacity="0.0"
例:
$('#mychart').find('svg rect:eq( 1 )').attr('fill-opacity','0.0');
使用eq :()选择器选择要透明的矩形 .
在购物车的左侧有一个下拉箭头 - 单击该按钮,然后转到“警察图表” .
粘贴图表时,您仍然可以选择链接图表,它将粘贴背景透明 .
5 回答
在图表的“配置选项”中,指定
这适用于Chrome和Firefox . 我花了一些时间来find out . doc page表示你只能输入HTML颜色字符串,我认为'transparent'不是其中之一 .
Setting a transparent background for Google Charts:
JSFIDDLE DEMO
backgroundColor:“00000000”为我工作 .
如果没有任何作用,请尝试在drawChart()函数的末尾找到背景矩形并添加fill-opacity属性 .
例:
使用eq :()选择器选择要透明的矩形 .
在购物车的左侧有一个下拉箭头 - 单击该按钮,然后转到“警察图表” .
粘贴图表时,您仍然可以选择链接图表,它将粘贴背景透明 .