Switch my variable chart witch contains 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" attribute is not static, it depends of the number of technicians who are in my database.
My columns are initialized 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 my question is : How can I put the attribute "month" in the Month column and all the values in "values" in the columns I created (in order of "values" and the order of the creation of number column) ?
Thanks in advance for your help !