Hi Mark,

This is certainly possible, but it can get a bit tricky. One
straightforward way you could accomplish this is simply by adding all the
rows from the second DataTable to the first one, and then sorting it. Here
is a jsfiddle sketch for how this might work: http://jsfiddle.net/f3yk43oe/

The second way that you could solve this is by using
google.visualization.data.join
<google.visualization.data.joinhttps://developers.google.com/chart/interactive/docs/reference#google_visualization_data_join>,
which would give you three output columns, and you would have to resolve
duplicate dates somehow (although you'd have to do that using the first
method as well, so I'm not sure there's a benefit to using join).

On Mon, Jun 1, 2015 at 3:55 AM Mark <[email protected]> wrote:

> Hello,
>
> Is there a way to join two similar queries into one areachart? The only
> difference between the two queries is the date.
>
>
> *Query one data:*
> google.visualization.Query.setResponse({"status":"ok","table":{"rows":[{"c":[{"v":"2014060200"},{"v":1}]},{"c":[{"v":"2014060201"},{"v":0}]},{"c":[{"v":"2014060202"},{"v":0}]},{"c":[{"v":"2014060203"},{"v":0}]},{"c":[{"v":"2014060204"},{"v":0}]},{"c":[{"v":"2014060205"},{"v":0}]},{"c":[{"v":"2014060206"},{"v":0}]},{"c":[{"v":"2014060207"},{"v":1}]},{"c":[{"v":"2014060208"},{"v":0}]},{"c":[{"v":"2014060209"},{"v":6}]},{"c":[{"v":"2014060210"},{"v":7}]},{"c":[{"v":"2014060211"},{"v":9}]},{"c":[{"v":"2014060212"},{"v":6}]},{"c":[{"v":"2014060213"},{"v":10}]},{"c":[{"v":"2014060214"},{"v":7}]},{"c":[{"v":"2014060215"},{"v":6}]},{"c":[{"v":"2014060216"},{"v":7}]},{"c":[{"v":"2014060217"},{"v":3}]},{"c":[{"v":"2014060218"},{"v":2}]},{"c":[{"v":"2014060219"},{"v":6}]},{"c":[{"v":"2014060220"},{"v":10}]},{"c":[{"v":"2014060221"},{"v":7}]},{"c":[{"v":"2014060222"},{"v":9}]},{"c":[{"v":"2014060223"},{"v":4}]}],"cols":[{"type":"string","id":"ga:dateHour","label":"ga:dateHour"},{"type":"number","id":"ga:transactions","label":"ga:transactions"}]},"reqId”:”0”,”version":"0.6"});
>
>
> *Query two data:*
> google.visualization.Query.setResponse({"status":"ok","table":{"rows":[{"c":[{"v":"2015060108"},{"v":5}]}],"cols":[{"type":"string","id":"ga:dateHour","label":"ga:dateHour"},{"type":"number","id":"ga:transactions","label":"ga:transactions"}]},"reqId”:”1”,”version":"0.6"});
>
> So I would like to display the data of the second query in the same chart.
>
> My code with one query:
>
>> google.setOnLoadCallback(drawVisualization);
>
> function drawVisualization () {
>>
>>
>>
>>     var query = new google.visualization.Query('
>>> https://test.appspot.com/query?id=98yu4fsftestewr&format=data-table-response'
>>> );
>>
>>
>>
>>     query.send(function (response) {
>>
>>         var data = response.getDataTable();
>>
>>
>>
>>         data.setColumnLabel(1, 'Aantal orders');
>>
>>
>>
>>         var sts_transactions_year_hourWrapper = new
>>> google.visualization.ChartWrapper({
>>
>>             containerId: "sts_stats_graph_1",
>>
>>             dataTable: data,
>>
>>             chartType: "AreaChart",
>>
>>         });
>>
>>         sts_transactions_year_hourWrapper.draw();
>>
>>
>>>     });
>>
>> }
>>
>>
>>>  --
> 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 [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to