I am developing a one-page AngularJS application that uses charts D3to display data recorded in different time zones around the world. The time axis on the graph should display the time in the original time zone.
The data to build is an array of values, pairs of timestamps. The timestamp contains its own time zone information and is encoded in ISO format(for example, "2003-12-14T12:00:00.000+08:00"). So json looks something like this:
"values": [
["2003-12-14T12:00:00.000+08:00", 10],
["2003-12-14T13:00:00.000+08:00", 20],
["2003-12-14T14:00:00.000+08:00", 30],
["2003-12-14T15:00:00.000+08:00", 40],
["2003-12-14T16:00:00.000+08:00", 50]
]
The timestamp and value are then added to the object, where the timestamp is instantly converted:
data = values[1];
timeStamp = moment.parseZone(values[0]);
D3 . , D3, . - , .
xAxis.tickFormat , , , Date Javascript .
, (- DST), .