Passing an object of type DataTable as a data attribute to google-chart does not work.
In the network tab I see a request to localhost that looks like this:
http://localhost:9001/[object%20Object]
/* istanbul ignore file *//* eslint-disable class-methods-use-this */import{LitElement}from'lit-element';import{html}from'lit-html';import'@google-web-components/google-chart';import{dataTable}from'@google-web-components/google-chart/loader.js';exportclassWbWebGeoChartextendsLitElement{staticgetproperties(){return{myDataTable: Object,};}asyncconnectedCallback(){super.connectedCallback();this.myDataTable=awaitdataTable();this.myDataTable.addColumn('string','Country');this.myDataTable.addColumn('number','Popularity');this.myDataTable.addRow(['Germany',1]);}render(){returnhtml`<google-charttype="geo" data="${this.myDataTable}"></google-chart> `;}}Documentation in google-chart.js says The data format can be a two-dimensional array or the DataTable format * expected by Google Charts.
What happens actually:
try{// Try to deserialize the value of the `data` property which might be a// serialized array.data=JSON.parse(data);}catch(e){isString=typeofdata==='string'||datainstanceofString;}if(isString){// Load data asynchronously, from external URL.dataPromise=fetch(data).then(response=>response.json());}In reality you just check if data is string and if not you fetch it (???)
This logic is not documented and looks a bit broken.
Was it done intentionally that you don't support passing of DataTable here?
Passing an object of type DataTable as a data attribute to google-chart does not work.
In the network tab I see a request to localhost that looks like this:
http://localhost:9001/[object%20Object]
Documentation in
google-chart.jssaysThe data format can be a two-dimensional array or the DataTable format * expected by Google Charts.What happens actually:
In reality you just check if
datais string and if not you fetch it (???)This logic is not documented and looks a bit broken.
Was it done intentionally that you don't support passing of
DataTablehere?