Need documentation on method setDataTable(table),

2019-08-02 04:19发布

问题:

When using Charts service in GAS, you can create different type of charts and most of them have two methods setDataTable(...) to push data in:

method setDataTable(tableBuilder)
method setDataTable(table)

For the first one you create a DataTableBuilder object using Charts.newDataTable(). But the second one is not documented enough for me.

Does anyone know the specification of the object table to transmit to the function ? It seems to me it can be an array or a map, but I had no success in using it.

Thanks,

回答1:

The second method takes in a DataTable, which is just the result of calling DataTableBuilder.build(). Unfortunately it's not possible to construct a pure JavaScript object that it will accept, and you'll need to use the DataTableBuilder.