My Dataset 1 is like this-
var data1 = new google.visualization.DataTable();
data1.addColumn('string','Country');
data1.addColumn('string','Data1');
for(var j=0;j<enterpriseArray.length;j++){
data1.addRows([[enterpriseArray[j], suspiciousCountArray[j]]]);
}
And Dataset 2 is pretty similar-
var data2 = new google.visualization.DataTable();
data2.addColumn('string','Country');
data2.addColumn('string','Data2');
for(var k=0;k<enterpriseArray.length;k++){
data2.addRows([[enterpriseArray[k], malicousCountArray[k]]]);
}
And finally this-
var jointData = google.visualization.data.join(data1, data2, 'full', [[0, 0]], [1], [1]);
var chart = new google.visualization.GeoChart(document.getElementById('some-div'));
chart.draw(jointData, options);
I get this error, not on the Console, but on the exact place where my chart is supposed to be displayed.
Error- Incompatible data table: Error: Table contains more columns than expected (Expecting 2 columns)
P.S.- If I use my dataset something like this (with hard-coded data, not dynamic)-
var data1 = google.visualization.arrayToDataTable([
['Country', 'Activity'],
['Germany', 100],
['United States', 200],
['India', 350],
]);
var data2 = google.visualization.arrayToDataTable([
['Country', 'Activity'],
['Germany', 200],
['United States', 300],
['India', 50],
]);
Then the chart/map is displayed correctly without any errors.