It's possible to group two datatables?
var cols =
[{"id":"ga:date","label":"date","type":"date"},{"id":"ga:sessions","label":"sessions","type":"number"},{"id":"ga:pageviews","label":"pageviews","type":"number"}];
var cols2 =
[{"id":"ga:date","label":"date","type":"date"},{"id":"ga:sessions","label":"sessions","type":"number"},{"id":"ga:pageviews","label":"pageviews","type":"number"}];
var rows= [
{"c":[{"v":"Date(2018, 07, 16)"},{"v":"149"},{"v":"559"}]},
{"c":[{"v":"Date(2018, 07, 17)"},{"v":"158"},{"v":"529"}]},
{"c":[{"v":"Date(2018, 07, 18)"},{"v":"110"},{"v":"404"}]},
{"c":[{"v":"Date(2018, 07, 19)"},{"v":"96"},{"v":"350"}]},
{"c":[{"v":"Date(2018, 07, 20)"},{"v":"242"},{"v":"883"}]}
];
var rows2= [
{"c":[{"v":"Date(2018, 08, 16)"},{"v":"119"},{"v":"229"}]},
{"c":[{"v":"Date(2018, 08, 17)"},{"v":"118"},{"v":"319"}]},
{"c":[{"v":"Date(2018, 08, 18)"},{"v":"110"},{"v":"414"}]},
{"c":[{"v":"Date(2018, 08, 19)"},{"v":"161"},{"v":"310"}]},
{"c":[{"v":"Date(2018, 08, 20)"},{"v":"212"},{"v":"813"}]}
];
var data = new google.visualization.DataTable({cols:cols,rows:rows});
var data2 = new google.visualization.DataTable({cols:cols2,rows:rows2});
var joinedData = google.visualization.data.join(data, data2, 'full',
[[0,0], [1,1], [2,2]], [1], [1]);
Here's a fiddle: https://jsfiddle.net/Tropicalista/94f8bmL0/16/
Il giorno martedì 25 febbraio 2014 11:20:12 UTC+1, KWeb ha scritto:
>
> I'm trying to create a line chart which has this current year's (or
> months) data and then to compare it to last year's (or months) data -
> similar to the functionality you have in Google Analytics where you can
> compare site traffic for this year against last year (see below screen shot)
>
>
> <https://lh6.googleusercontent.com/-LSmPkGdrgiE/UwxtwLLZAzI/AAAAAAAAAI0/Q4-gxTP6pwg/s1600/Chart.jpg>
> I can't seem to work out how to plot these 2 sets of data on the same
> chart because one would have dates from a different range to the other set.
>
> Any pointers/advice would be really appreciated.
>
> Thanks
>
--
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 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/63659380-2a8a-4309-ac92-883dd9ca094c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.