如何更改Google表格中图表的背景不透明度? [英] How To Change Background Opacity of Charts inside Google Sheets?

查看:118
本文介绍了如何更改Google表格中图表的背景不透明度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Google表格中设置Google图表的透明度或不透明度(就像在Microsoft Excel中一样-将图像设置在文本后面,以便文本仍然可读)

I want to set the transparency or the opacity of the Google Charts in Google Sheets (just like in Microsoft Excel - set the image behind the text so the text still readable)

但是,该功能似乎无法正常工作. 功能预览

However it seems the function is not working. Preview of the function

示例链接到我的文档.

我也尝试将应用脚本setBackgroundColor(cssValue)#ffffff一起使用,但均无法正常工作,但发现

I have tried also with the apps script setBackgroundColor(cssValue) with #ffffff but not working either and found this.

任何解决方案将不胜感激.

Any solution will be very appreciated.

推荐答案

使用:

.setOption('backgroundColor.fillOpacity',50) 

在文档中,有一个有关如何修改现有图表的示例:

In the documentation, there is an example of how to modify an existing chart:

var sheet = SpreadsheetApp.getActiveSheet();
 var range = sheet.getRange("A2:B8")
 var chart = sheet.getCharts()[0];
 chart = chart.modify()
     .addRange(range)
     .setOption('title', 'Updated!')
     .setOption('animation.duration', 500)
     .setPosition(2,2,0,0)
     .build();
 sheet.updateChart(chart);

嵌入式图表类

Class EmbeddedChartBuilder

设置选项

在更改图表之前,您需要获取参考.工作表中只有一个图表,因此它的索引应该为零:

Before you can change the chart, you need to get a reference it. There is only one chart in your sheet, so it should be index zero:

var chart = sheet.getCharts()[0];

您将需要一种触发该功能的方法.我不知道您是否要在电子表格加载时或在用户驱动的事件上进行设置.

You'll need a way to trigger the function. I don't know if you want to set that when the spreadsheet loads, or on a user driven event.

这篇关于如何更改Google表格中图表的背景不透明度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆