I have a set of products for which we record metrics overtime. Not all
products get metrics every day. I am trying to graph the metrics overtime
so that each product is it's own series and it shows what the metrics where
on each date for each one of the products (the table below has two metrics,
speed and firmness which I would graph in separate charts)
[image: Sample Dataset]
I've found a way to do it for 2 products by using join data as shown below.
however, this only works for 2 data sets and no more. Has anyone done
anything similar? I've been working on this all day today and I have not
been able to figure out a way to do it.
var data = new google.visualization.DataTable();
data.addColumn('date', 'Time of Day');
data.addColumn('number', 'Rating');
data.addRows([
[new Date(2015, 0, 1), 5], [new Date(2015, 0, 2), 7], [new
Date(2015, 0, 3), 3],
[new Date(2015, 0, 4), 1], [new Date(2015, 0, 5), 3], [new
Date(2015, 0, 6), 4],
[new Date(2015, 0, 7), 3], [new Date(2015, 0, 8), 4], [new
Date(2015, 0, 9), 2],
[new Date(2015, 0, 10), 5], [new Date(2015, 0, 11), 8], [new
Date(2015, 0, 12), 6],
]);
var data2 = new google.visualization.DataTable();
data2.addColumn('date', 'Time of Day');
data2.addColumn('number', 'Rating 2');
data2.addRows([
[new Date(2015, 0, 7), 8], [new Date(2015, 0, 8), 6], [new
Date(2015, 0, 9), 2],
[new Date(2015, 0, 10), 5], [new Date(2015, 0, 11), 8], [new
Date(2015, 0, 12), 6],
]);
var joinedData = google.visualization.data.join(data, data2, 'full',
[[0, 0]], [1], [1]);
var options = {
title: 'Rate the Day on a Scale of 1 to 10',
hAxis: {
format: 'M/d/yy',
gridlines: {count: 15}
},
vAxis: {
gridlines: {color: 'none'},
minValue: 0
}
};
var chart = new
google.visualization.LineChart(document.getElementById('ch
--
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.