Hello there,
I am trying to use Google Sheets API but there one thing making me crazy:(
Wonder if anyone has a better (or at least a) solution.
I am generating Pie charts. Works perfectly but I want to be able to change
the colours, do not want to use the default red and blue colours.
I could not find any parameters to set the Pie Chart colours. So I came up
with a great idea...:D
I created a source sheet, manually generated a Pie chart with the colours I
wanted. Then once I create a sheet with data I was copying the chart from
the source.
Worked like a charm. I know this is not the best way but... it solved my
problem.
But then I realised something, the chart title was the same from the source
title:D Then I decided to create an update request (which is below) and
then got mad because once I run this title update it literally dumps the
colours I used in my source chart. I really do not understand why we do not
get to set colours on Pie chart only...
Does anyone have a solution to this issue? A walk around maybe?
update_chart_title = [{
"updateChartSpec": {
"chartId": chart_id,
"spec": {
"title": "New Chart Title",
"pieChart": {
"domain": {
"sourceRange": {
"sources": [
{
"sheetId": sheet_id,
"startRowIndex": 0,
"endRowIndex": 2,
"startColumnIndex": 1,
"endColumnIndex": 2,
}
]
}
},
"series": {
"sourceRange": {
"sources": [
{
"sheetId": sheet_id,
"startRowIndex": 0,
"endRowIndex": 7,
"startColumnIndex": 2,
"endColumnIndex": 3
}
]
}
},
}
},
}
}]
body = {
'requests': update_chart_title
}
getService.sheets.spreadsheets().batchUpdate(
spreadsheetId=sheet,
body=body).execute()
Thank you!
--
You received this message because you are subscribed to the Google Groups
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.