Deleted member 66701
D
Deleted member 66701
Hi all. I have the following code:-
htmlString contains
However the call to the chart api fails with "Uncaught Error: Every row given must be either null or an array." I think this is because data.addRows expects an array of arrays as a parameter but I'm passing a string.
I don't know how to solve this.
Code:
google.load('visualization', '1', {packages:['orgchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var htmlString = $("div#chartContents").html();
htmlString = htmlString.replace(/<br>/g,'');
htmlString = htmlString.replace(/\s+/g, '');
alert(htmlString);
var data = new google.visualization.DataTable();
data.addColumn('string', 'Node');
data.addColumn('string', 'Parent');
Possible problem?---> data.addRows(htmlString);
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
chart.draw(data);
}
htmlString contains
Code:
[['Room 1', ''],
['Room 2', 'Room 1'],
['Room 3', 'Room 1']]
However the call to the chart api fails with "Uncaught Error: Every row given must be either null or an array." I think this is because data.addRows expects an array of arrays as a parameter but I'm passing a string.
I don't know how to solve this.
Last edited by a moderator: