当年话下
在这种情况下,我建议将bubbleMaxRadiusSize和包含bubbleMinRadiusSize在请求正文中,如下所示。当你的请求体被修改后,就变成了下面这样。从:'bubbleOpacity': 1.0}},到:'bubbleOpacity': 1.0,'bubbleMaxRadiusSize': 50,'bubbleMinRadiusSize': 5}},在此修改中,50和分别5用作 和 的样本bubbleMaxRadiusSize值bubbleMinRadiusSize。所以请根据您的实际情况修改这些值。结果:整个脚本:body = {'requests': [{'addChart': {'chart': {'spec': {'title': 'Correlation between life expectancy, fertility rate and population of some world countries (2010)', 'titleTextPosition': {'horizontalAlignment': 'CENTER'}, 'bubbleChart': { 'legendPosition': 'RIGHT_LEGEND', 'domain': {'sourceRange': {'sources': [{ 'sheetId': 909072886, 'startRowIndex': 17, 'endRowIndex': 27, 'startColumnIndex': 1, 'endColumnIndex': 2, }]}}, 'series': {'sourceRange': {'sources': [{ 'sheetId': 909072886, 'startRowIndex': 17, 'endRowIndex': 27, 'startColumnIndex': 2, 'endColumnIndex': 3, }]}}, 'groupIds': {'sourceRange': {'sources': [{ 'sheetId': 909072886, 'startRowIndex': 17, 'endRowIndex': 27, 'startColumnIndex': 3, 'endColumnIndex': 4, }]}}, 'bubbleLabels': {'sourceRange': {'sources': [{ 'sheetId': 909072886, 'startRowIndex': 17, 'endRowIndex': 27, 'startColumnIndex': 0, 'endColumnIndex': 1, }]}}, 'bubbleSizes': {'sourceRange': {'sources': [{ 'sheetId': 909072886, 'startRowIndex': 17, 'endRowIndex': 27, 'startColumnIndex': 4, 'endColumnIndex': 5, }]}}, 'bubbleOpacity': 1.0, 'bubbleMaxRadiusSize': 50, # Added 'bubbleMinRadiusSize': 5, # Added }}, 'position': {'overlayPosition': { 'anchorCell': {'sheetId': 909072886, 'rowIndex': 61, 'columnIndex': 6}, 'offsetXPixels': 0, 'offsetYPixels': 0, 'widthPixels': 600, 'heightPixels': 371, }}}}}]}response = service.spreadsheets().batchUpdate(spreadsheetId=file_id, body=body).execute()