Google visualization API requires arrays like this:
var data = google.visualization.arrayToDataTable([
['Element', 'Density', { role: 'style' }],
['Copper', 8.94, '#b87333'], // RGB value
['Copper', 10.49, 'silver'], // English color name
['Gold', 19.30, 'gold'],
['Gold', 21.45, 'color: #e5e4e2' ], // CSS-style declaration
]);
I have separately array of columns
var columns = ['Copper', 'Copper', 'Gold', 'Gold'];
for values
var values = [8.94, 10.49, 19.30, 21.45];
and for colors
var styles = ['#b87333', 'silver', 'gold', 'color: #e5e4e2'];
Am I really in need to write multilevel loop with multiple conditions to build this array? Or there are simpler ways?
I can't push because arrays should be intact.