From 31eddad373355fb39fa948b65f9ba29e3f594e61 Mon Sep 17 00:00:00 2001 From: Adam Vartanian Date: Wed, 24 Mar 2010 18:20:49 -0400 Subject: [PATCH] Properly format timestamps at 00:00:00 with non-zero milliseconds on x axis. Update docs for X axis formatting. --- docs/index.html | 7 +++++++ dygraph.js | 2 +- tests/x-axis-formatter.html | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 757e660..1035783 100644 --- a/docs/index.html +++ b/docs/index.html @@ -699,6 +699,13 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high) + xAxisLabelFormatter + function(date, granularity) + Dygraph.dateAxisFormatter + Function to call to format values along the x axis. +
Tests: xAxisLabelFormatter
+ + rightGap integer diff --git a/dygraph.js b/dygraph.js index a83cbe2..26a3812 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1110,7 +1110,7 @@ Dygraph.dateAxisFormatter = function(date, granularity) { if (granularity >= Dygraph.MONTHLY) { return date.strftime('%b %y'); } else { - var frac = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds(); + var frac = date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds() + date.getMilliseconds(); if (frac == 0 || granularity >= Dygraph.DAILY) { return new Date(date.getTime() + 3600*1000).strftime('%d%b'); } else { diff --git a/tests/x-axis-formatter.html b/tests/x-axis-formatter.html index 96b3e06..04c2915 100644 --- a/tests/x-axis-formatter.html +++ b/tests/x-axis-formatter.html @@ -1,6 +1,6 @@ - hourly + X Axis Label Formatting -- 2.7.4