你好,我对谷歌表格中的饼图有疑问。我的图表只使用一列 (B)
我正在使用一个函数来动态更改字幕。
function onEdit(event) {
var sheet = event.source.getActiveSheet();
var cell = sheet.getRange("W2");
var games = cell.getValue();
var valuss = "Bei "+ games + " Spielen";
//chartID: 406659648
// Get the chart to update
var chart = sheet.getCharts()[0]; // replace 0 with the index of the chart you want to update (if you have multiple charts)
// Update the chart title with the new value
chart = chart.modify().setOption('subtitle', valuss).build();
sheet.updateChart(chart);
var values = sheet.getRange("A1:B").getValues();
// Update the appropriate cell with the new subtitle
values[0][1] = newValue;
// Set the updated values back to the range
sheet.getRange("A1:B").setValues(values);
chart = chart.modify().setOption('options', options).build();
sheet.withSuccessHandler(function(){
SpreadsheetApp.flush(); // Force the changes to be applied immediately
}).getCharts();
}
在德语中表示“至少需要 2 列,但只有 1 列可用”
如果我现在单击“聚合”复选框,图表看起来非常好并且副标题已正确编辑。
有人知道这是为什么吗
最好的问候, 卢卡斯