I have the following javascript which I need to make dynamic.
data.addRows(2);
data.setValue(0, 0, 'name goes here');
data.setValue(0, 1, value 1 goes here);
data.setValue(0, 2, value 2 goes here);
data.setValue(1, 0, 'name goes here');
data.setValue(1, 1, value 1 goes here);
data.setValue(1, 2, value 2 goes here);
I guess a loop is the best way to go forward:
I have come up with the following json structure:
[
{"User1":{"value1": 50.00,"value2": "100"}},
{"User2":{"value1": 10.00,"value2": "20"}},
{"User3":{"value1": 10.00,"value2": "20"}},
{"User4":{"value1": 10.00,"value2": "20"}},
{"User5":{"value1": 20.00,"value2": "40"}}
]
I think this structure needs improving. Can someone please suggest a better structure to make it very easy for me to extract the data I want to extract from this?