Modify my variable chart
which currently holds this JSON:
[{
"month": "January",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "February",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "March",
"values": [35, 3, 8, 18, 0, 0, 0, 0, 0]
}, {
"month": "April",
"values": [36, 1, 0, 2, 0, 0, 0, 0, 0]
}, {
"month": "May",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "June",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "July",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "August",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "September",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "October",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "November",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
"month": "December",
"values": [0, 0, 0, 0, 0, 0, 0, 0, 0]
}]
The values in the "values" attribute are dynamic and depend on the number of technicians in my database.
I have initialized my columns like this:
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
var techlist = @Html.Raw(Json.Encode(ViewBag.techs));
for(var j=0; j<@ViewBag.nbTechs;j++){
data.addColumn('number', techlist[j]);
}
So, I am wondering: How can I assign the "month" attribute to the Month column and distribute all the values in "values" across the columns I created (in the same order as they appear in "values" and matching the order of creation of number columns)?
Thank you for your assistance!