Join multiple DataTables (to make a chart with multiple lines)

30 views
Skip to first unread message

Milan Slesarik

unread,
Nov 19, 2016, 8:51:40 AM11/19/16
to Google Visualization API
Hello guys,

I'm trying to create a function which creates a Chart from a JSON. The keys in this JSON are "lines". 

So function creates a multiple DataTables and then, it tries to join them and create a Chart. The problem is that it acts like it joins the first and last table because I see there only 2 lines.


As you can see there are multiple keys (shops) in the JSON but only the first and last one are shown on a graph. 

JOIN SNIPPET from my code where datas is an array of DataTables:

var joinedData = datas[0];
$.each(datas, function (index, data1) {
console.log('joining index '+index)
if (index != 0) {
joinedData = google.visualization.data.join(joinedData, data1, 'full', [[0, 0]], [1], [1]);
}
});

Do you know what should I do to draw all lines?
Reply all
Reply to author
Forward
0 new messages