Issue with Ajax/JSON

已查看 32 次
跳至第一个未读帖子

Chris Thomas

未读,
2021年3月31日 15:56:162021/3/31
收件人 Google Visualization API

I have a head scratcher.  When I send this info into the chart all works fine.

var data = new google.visualization.arrayToDataTable([['Quarter', 'Current Enrollment','SBHC Enrollment','Patients Seen'],['Quarter 1',1500,800,600],['Quarter 2',1450,840,700],

['Quarter 3',1480,920,800]],false);


But when I send this in 

var data = new google.visualization.arrayToDataTable(myarray);

I get nothing.  The value of myarray is EXACTLY the same as the data above. I've checked it in an alert and console.log and even added characters to each end to make sure there's no hidden characters messing things up.


Any thoughts?

Daniel LaLiberte

未读,
2021年3月31日 16:06:482021/3/31
收件人 Google Visualization API
google.visualization.arrayToDataTable is not a constructor, but just a function that internally calls the DataTable constructor.  So remove the 'new' operator and both might work.  Not sure why it would work differently for each of your calls.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/c44ced11-bd21-40f0-8307-1f19509a2c42n%40googlegroups.com.


--

Daniel LaLiberte

 • SWE

 Cambridge MA

 • dlaliberte@Google.com

Chris Thomas

未读,
2021年3月31日 16:08:422021/3/31
收件人 Google Visualization API
as I said, the first works and removing new has no impact on the other running.  So not the issue.
已删除帖子

Chris Thomas

未读,
2021年3月31日 16:18:522021/3/31
收件人 Google Visualization API
Error displayed when sending data in array variable.

Uncaught (in promise) Error: Column header row must be an array.

No error when using the exact same string hard coded.
回复全部
回复作者
转发
0 个新帖子