How to set Series Opacity in Google Sheets Embedded (Scatter) Chart with App Script

305 views
Skip to first unread message

Paul Coppinger

unread,
Dec 21, 2022, 6:15:43 PM12/21/22
to Google Apps Script Community

How do I set this value using Google App Script?

Chart Customize.png

I have followed the guidance in this reference, but there isn't an option listed to control the opacity of the series. Other chart types (such as Combo Chart) support this option, but Scatter Chart does not.

However, as you can see in the image, there is an option available through the user interface that allows the opacity of a series point in a Scatter Chart to be changed...so we know that it must be possible. How?

cwl...@gmail.com

unread,
Dec 22, 2022, 8:02:22 AM12/22/22
to Google Apps Script Community
I'm not sure if this will work, but if you are using a color name for the series color (e.g., "black"), try using a hex value (e.g.,  #000000). But also include in the hex value the opacity like this:   #00000080. 

I don't know if it will complain about the extra 2 digits or not. You can use this online converter to convert rgba to hex: 

cwl...@gmail.com

unread,
Dec 22, 2022, 8:07:31 AM12/22/22
to Google Apps Script Community
Also check out this example,  and read the last sentence in that section about "dataOpacity".

David Allcock

unread,
Feb 13, 2023, 12:23:42 PM2/13/23
to Google Apps Script Community
I spent ages looking into this too.  In the end you do it *almost* like the first answer - namely:

  .setOption('series.0.color', 'rgba(255,0,0,0.1)')

This would set your series with index 0 to be 10% transparency red.

I have tried it, it works.  Hope this helps!
Reply all
Reply to author
Forward
0 new messages