Having trouble with the dygraphs.
I've extracted an array from PHP that appears like this:
data = [
{
"DATA": "2016-01-22",
"TOTAL": [
"7",
"4",
"20",
"0"
]
},
{
"DATA": "2016-01-25",
"TOTAL": [
"3",
"2",
"10",
"0"
]
},
{
"DATA": "2016-01-26",
"TOTAL": [
"1",
"1",
"4",
"0"
]
},
{
"DATA": "2016-01-27",
"TOTAL": [
"2",
"1",
"2",
"0"
]
},
{
"DATA": "2016-02-02",
"TOTAL": [
"1",
"1",
"1",
"0"
]
},
{
"DATA": "2016-02-10",
"TOTAL": [
"1",
"1",
"3",
"0"
]
}
]
The graph data is then constructed as follows:
data.forEach(function(item) {
var adata = item.DATA;
var atotal = item.TOTAL;
graphstr1 += '[new Date("' + adata + '"),' + atotal + '],';
});
graphstr1 = graphstr1.slice(0, -1);
console.log(graphstr1);
After checking the console, the data seems to be correctly formatted, but I keep encountering the error mentioned in the title
Dygraph implementation:
g = new Dygraph(
document.getElementById("graphdiv"),
[
graphstr1,
], {
labels: ["x", "Registered", "Pregnant", "With Children", "Without Children"]
}
);