From: Adam Vartanian Date: Wed, 24 Mar 2010 22:20:49 +0000 (-0400) Subject: Properly format timestamps at 00:00:00 with non-zero milliseconds on x axis. X-Git-Tag: v1.0.0~700 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=31eddad373355fb39fa948b65f9ba29e3f594e61;p=dygraphs.git Properly format timestamps at 00:00:00 with non-zero milliseconds on x axis. Update docs for X axis formatting. --- 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