我是一个修改电子表格嵌入式图表标题和范围的脚本,如下所示:
var title = chart.getOptions().get('title');
var legend = chart.getOptions().get('legend');
var ranges = chart.getRanges();
var builder = chart.modify();
for (var j in ranges) {
var range = ranges[j];
// rangeShouldExpand is defined later.
var newRange = getTableNewRange_(range);
if (newRange !== null) {
// Removes the old range and substitutes with new one.
builder.removeRange(range);
builder.addRange(newRange);
}
}
// Update title
builder.setOption('title', newTitle);
// as Google may have a bug of disappearing legends on updating chart then reset the legend as before
builder.setOption('legend', legend);
sheet.updateChart(builder.build());
由于某些原因,传说在执行此操作时不断消失。因此,我添加了一个代码来获取图表图例选项并重置它但它仍在发生。有人能告诉我,我做错了什么导致传说消失了吗?
THX!
答案 0 :(得分:0)
我已经提交了一份错误报告,它似乎已于1月21日解决。