I'm developing a Google Geochart and I'd like it to be dynamic. This is the static code to make the array to store the two values are as follows. The Country is the unique identifier for the map and the colour value is what the colour of the map will be. (Irrelevant but context)
arrayData = [['Country','Color Value'],
['China',3],
['Russia',2.6],
['France',2.5],
['Spain',2.4],
['Portugal',1.1]
I'd like to be able to make this array from a for loop taken from php echo values. Something like this pseudo code;
for (i in range table.length)
arrayData = [['Country','Color Value'],
[<?php echo $statements["Country"]; ?>], [<?php echo $statements["Color_Value"]; ?>],
So similar to a php table as it gets all the values, I would like to do the same but for a JavaScript array. Any advice would be kind!
EDIT: The static code is an example, I want to take values from the database, the first value being country and the second value being colour value. BOTH from the database. I suppose in turn making the geochart dynamic