From: Joan Pau Beltran Date: Mon, 10 Feb 2014 11:11:24 +0000 (+0100) Subject: Added UTC date label tests and adapted existing ones. X-Git-Tag: v1.1.0~31^2~14 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=4c765ad994f31064b8f1a2793cdb87ff95834db8;p=dygraphs.git Added UTC date label tests and adapted existing ones. * tests/labelsDateUTC.html: New test/demo for the option `labelsDateUTC`. Display several days of data according to UTC and to local time, and compare the tick placement and the label format. * tests/x-axis-formatter.html: Added `opts` argument to `axisLabelFormatter` function (used by inner `Dygraphs.dateAxisLabelFormatter` call). --- diff --git a/tests/labelsDateUTC.html b/tests/labelsDateUTC.html new file mode 100644 index 0000000..a4abfc3 --- /dev/null +++ b/tests/labelsDateUTC.html @@ -0,0 +1,64 @@ + + + + + UTC date labels + + + + + + +

UTC date and time labels

+ +

This shows how date ticks and labels may be generated according to local + time (default) or UTC with the option labelsDateUTC.

+ +

72 hours of random hourly data since 2009-Jul-23 18:00 UTC + according to local time (top) and UTC (bottom):

+ +
+
+ +

Please note the offset between the respective ticks in both plots. + It should match your local time zone offset.

+ +

You can also check it by hovering over corresponding points and comparing + the value labels.

+ +

Try different zoom levels to show that ticks are always placed at nice + time boundaries.

+ + + + + diff --git a/tests/x-axis-formatter.html b/tests/x-axis-formatter.html index d216c97..9983391 100644 --- a/tests/x-axis-formatter.html +++ b/tests/x-axis-formatter.html @@ -47,8 +47,8 @@ { axes: { x: { - axisLabelFormatter: function(d, gran) { - return Dygraph.dateAxisFormatter(new Date(d.getTime() + 7200*1000), gran); + axisLabelFormatter: function(d, gran, opts) { + return Dygraph.dateAxisLabelFormatter(new Date(d.getTime() + 7200*1000), gran, opts); } } }