From 4c765ad994f31064b8f1a2793cdb87ff95834db8 Mon Sep 17 00:00:00 2001 From: Joan Pau Beltran Date: Mon, 10 Feb 2014 12:11:24 +0100 Subject: [PATCH] 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). --- tests/labelsDateUTC.html | 64 +++++++++++++++++++++++++++++++++++++++++++++ tests/x-axis-formatter.html | 4 +-- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tests/labelsDateUTC.html 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); } } } -- 2.7.4