Joining 2 JSON tables

35 views
Skip to first unread message

darren....@internode.on.net

unread,
Apr 1, 2017, 10:44:08 PM4/1/17
to Google Visualization API
Hi All,
I am trying to join 2 json tables to display as on graph
the tables are $jsonTable & $jsonTable2.
both of these contain temperature and time entries from separate sensors and gathered at different times.
but not sure on the correct formatting to adapt this to join the json

basically I want to adapt the code below to show each table on the same graph as different colours

var data = new google.visualization.DataTable(<?=$jsonTable?>);


Any help would be greatly appreciated
Darren

Darren Macleod

unread,
Apr 5, 2017, 11:48:54 PM4/5/17
to Google Visualization API
Hi Daniel,
just wondering if you could point me in the right direction on this one?

Thanks
Darren

Daniel LaLiberte

unread,
Apr 6, 2017, 9:23:58 AM4/6/17
to Google Visualization API
You're not actually joining the json, so think in terms of how the json ends up in each DataTable. 

Maybe the problem is that a join is not really what you want. The join operation is designed to merge table rows based on identical values in different columns of each table. Since both your tables have the same kind of data, then maybe what you really want is just to append one table to the other, or merge them, sorting on the time column, for example.  We don't have an append operation, though you could pretty easily iterate through the rows of one table and add them to the other.

Hope that helps.

--
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-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f7bb3b79-7816-401b-8874-ceb861b5ee8f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages