I really do not know how to put the question, I hope some one would assist me. this is what I want to achieve anyway. I want to use the google visualization to create charts.
This is what I want to achieve.
var arrayNeeded = [['Population', 'Total Number Per Unit'],['Staff Count', 5686],['Student Count', 9890]];
var data = google.visualization.arrayToDataTable(array);
This is what I have:
var arr1 = [5686, 9890];
var arr2 = [Staff Count, Student Count];
How do I put these two arrays to give me the array called "arrayNeeded". here's what I have done. I'm a learner at javascript so it's kinda messy.
var obj = JSON.parse(sessionStorage.getItem('custs'));
var result = [];
for (var i = 0; i < obj.lgaid.length; i++)
{
result[i] = "['"+obj.lgan[i]+"',"+ parseInt(obj.lgaid[i])+"]";
}
obj is an object with two arrays lgan and lgaid in it
The result gives me an array of strings like this ("['Student Count', 9890]") rather than an array of 2-column arrays
var result = "['Population', 'Total Number Per Unit']","['Staff Count', 5686]","['Student Count', 9890]";
Please, someone, help me out. Thanks.