time.tickFormat()

time.tickFormat([count[, specifier]])
time.tickFormat([interval[, specifier]])

Returns a time format function suitable for displaying tick values. The specified count or interval is currently ignored, but is accepted for consistency with other scales such as continuous.tickFormat. If a format specifier is specified, this method is equivalent to format. If specifier is not specified, the default time format is returned. The default multi-scale time format chooses a human-readable representation based on the specified date as follows:

  • %Y - for year boundaries, such as 2011.
  • %B - for month boundaries, such as February.
  • %b %d - for week boundaries, such as Feb 06.
  • %a %d - for day boundaries, such as Mon 07.
  • %I %p - for hour boundaries, such as 01 AM.
  • %I:%M - for minute boundaries, such as 01:23.
  • :%S - for second boundaries, such as :45.
  • .%L - milliseconds for all other times, such as .012.

Although somewhat unusual, this default behavior has the benefit of providing both local and global context: for example, formatting a sequence of ticks as [11 PM, Mon 07, 01 AM] reveals information about hours, dates, and day simultaneously, rather than just the hours [11 PM, 12 AM, 01 AM]. See d3-time-format if you’d like to roll your own conditional time format.

doc_D3_Js
2016-11-24 10:29:17
Comments
Leave a Comment

Please login to continue.