I try a little with dygraph. I get my data from an ajax call and I need to convert my returned JSON array to a JavaScript array.
Now my dygraph options look like this
series = {
sample1: {
color: 'Green',
strokeWidth: 3,
pointSize: 4
},
sample2: {
color: 'DarkBlue',
strokeWidth: 2,
pointSize: 3
},
sample3: {
color: 'DarkOrange',
strokeWidth: 1,
pointSize: 2
}
}
dygraph_options = {
title: title,
labels: jsonDataTable.labels,
series: series,
...
}
My php ajax call look like this:
$series = array();
$series[] = array( 'sample1' => array('color' => 'Green'));
$series[] = array( 'sample2' => array('color' => 'DarkBlue'));
$series[] = array( 'sample3' => array('color' => 'DarkOrange'));
$table = array( "series" => $series, "labels" => $labels, "data" => $rows );
return $table;
I want to get the series from json. But my returned series are different from the javascript series:
jsonDataTable.series -> [Object { stock={...}}, Object { forecast={...}}]
javascript series -> Object { stock={...}, forecast={...}, training={...}}
I try a lot but can't get it working.