Google apps script 如何在谷歌电子表格图表上画一条线

Google apps script 如何在谷歌电子表格图表上画一条线,google-apps-script,google-sheets,graph,charts,visualization,Google Apps Script,Google Sheets,Graph,Charts,Visualization,我用谷歌工作表中的一些数据创建了一个标准条形图,x轴是日期,y轴是交互次数,嵌入在谷歌工作表中 我想在图表中添加一条垂直线,以指示应该对数据产生影响的特定事件发生的日期。描述该日期前后的事物 是否有任何方法,使用正常界面或谷歌工作表可用的谷歌应用程序脚本-或其他-在图表上的任意位置绘制一条垂直线,可能带有标签 然后将图表导入谷歌幻灯片演示文稿。在x轴上使用线条批注 在x轴列之后向数据表添加注释列 var data = new google.visualization.DataTable(); d

我用谷歌工作表中的一些数据创建了一个标准条形图,x轴是日期,y轴是交互次数,嵌入在谷歌工作表中

我想在图表中添加一条垂直线,以指示应该对数据产生影响的特定事件发生的日期。描述该日期前后的事物

是否有任何方法,使用正常界面或谷歌工作表可用的谷歌应用程序脚本-或其他-在图表上的任意位置绘制一条垂直线,可能带有标签


然后将图表导入谷歌幻灯片演示文稿。

在x轴上使用线条批注

在x轴列之后向数据表添加注释列

var data = new google.visualization.DataTable();
data.addColumn({label: 'Date', type: 'date'});
data.addColumn({role: 'annotation', type: 'string'});  // <-- annotation column
data.addColumn({label: 'Interactions', type: 'number'});
// add row
data.addRow([
  new Date(2020, 3, 21),
  'Happy Birthday!',      // <-- annotation column
  250
]);
然后,对于垂直线应显示的日期,
添加应显示在批注列中的文本

var data = new google.visualization.DataTable();
data.addColumn({label: 'Date', type: 'date'});
data.addColumn({role: 'annotation', type: 'string'});  // <-- annotation column
data.addColumn({label: 'Interactions', type: 'number'});
// add row
data.addRow([
  new Date(2020, 3, 21),
  'Happy Birthday!',      // <-- annotation column
  250
]);
请参阅以下工作片段

google.charts.load('current'{
软件包:['corechart']
}).然后(函数(){
var data=new google.visualization.DataTable();
addColumn({label:'Date',type:'Date'});

data.addColumn({role:'annotation',type:'string'});//但是在电子表格中有什么方法可以使用吗?没有涉及任何网页,它只是导入到google幻灯片演示文稿中,没有发布到任何地方。您可以使用带有以下方法的in-apps脚本添加注释列。。。