1

如何在 Internet Explorer 的 Google 图表中制作透明背景?

我用过

'backgroundColor':'transparent''backgroundColor' = {fill: <color>};

它适用于 FF、Chrome、Safari 和 Opera,但不适用于 Internet Explorer。

有没有办法让它在 Internet Explorer 中透明?

4

2 回答 2

4

我有同样的问题,Internet Explorer 7,8 将在 iframe 上显示图表,所以我在 iframe 使用事件准备好的图表上将 jQuery 添加到正文标签的透明背景。

google.load("visualization", "1", {packages:["corechart"]});                                
                            google.setOnLoadCallback(drawChart);                                
                            function drawChart() {
                                var data = google.visualization.arrayToDataTable([
                                    ['', ''],
                                    ['', 2],
                                    ['', 8]
                                ]);

                                var options = {
                                    colors: ['#b28dc1', '#79449a'],
                                    legend: {position: 'none'},
                                    backgroundColor: 'transparent',
                                    pieSliceText: 'value',
                                    pieHole: 0.55,
                                    pieSliceBorderColor: 'none'
                                };

                                var chart = new google.visualization.PieChart(document.getElementById('chart1'));
                                google.visualization.events.addListener(chart, 'ready', addIETransparentBg);                                        
                                chart.draw(data, options);                                                                  
                            }
                            function addIETransparentBg(e) {
                                $("iframe").contents().find("body").css({'background': 'none'});
                            }
于 2013-04-15T09:24:31.720 回答
1

这可以通过以下任一方式完成

backgroundColor: {stroke:null, fill:null, strokeSize: 0} // or
 backgroundColor:#colorcode ;

或者您可以添加空白 png 图像背景来执行此操作

于 2013-01-10T08:57:01.193 回答