Can anyone help? I'm attempting to plot the time on the x-axis of my line graph and having real problems achieving this.
At the moment y-axis depicts "reading":
d3.json('getdata.php',function (jsondata) {
var data = jsondata.map(function(d) { return d.reading; });
var x = d3.scale.linear().domain([0, data.length]).range([0, width]);
var y = d3.scale.linear().domain([0, d3.max(jsondata, function(d) {
return parseInt(d.reading); })]).range([height,0]);The output from "getdata.php" is in the following format:
[{"reading":"10","Time":"2012-11-01 00:00:00"},{"reading":"10.2","Time":"2012-11-01 00:02:00"}......
I get a parse error if I change:
var data = jsondata.map(function(d) { return d.reading; }); to
var data = jsondata.map(function(d) { return d.Value; }); I know it may seem like a very simple question but how do I read in both "reading" and "Time"?
Would also really appreciate any help with how to format/parse DateTime to depict Time only?