mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Update Display Format table
- Up to date with the latest code - Added Example column
This commit is contained in:
parent
2a7df85180
commit
e543f87d5f
@ -17,7 +17,7 @@ The following options are provided by the time scale. They are all located in th
|
||||
| `tooltipFormat` | `String` | | The moment js format string to use for the tooltip.
|
||||
| `unit` | `String` | `false` | If defined, will force the unit to be a certain type. See [Time Units](#scales-time-units) section below for details.
|
||||
| `stepSize` | `Number` | `1` | The number of units between grid lines.
|
||||
| `minUnit` | `String` | `millisecond` | The minimum display format to be used for a time unit.
|
||||
| `minUnit` | `String` | `'millisecond'` | The minimum display format to be used for a time unit.
|
||||
|
||||
## Date Formats
|
||||
|
||||
@ -58,17 +58,17 @@ var chart = new Chart(ctx, {
|
||||
## Display Formats
|
||||
The following display formats are used to configure how different time units are formed into strings for the axis tick marks. See [moment.js](http://momentjs.com/docs/#/displaying/format/) for the allowable format strings.
|
||||
|
||||
Name | Default
|
||||
--- | ---
|
||||
millisecond | 'SSS [ms]'
|
||||
second | 'h:mm:ss a'
|
||||
minute | 'h:mm:ss a'
|
||||
hour | 'MMM D, hA'
|
||||
day | 'll'
|
||||
week | 'll'
|
||||
month | 'MMM YYYY'
|
||||
quarter | '[Q]Q - YYYY'
|
||||
year | 'YYYY'
|
||||
Name | Default | Example
|
||||
--- | --- | ---
|
||||
millisecond | 'h:mm:ss.SSS a' | 11:20:01.123 AM
|
||||
second | 'h:mm:ss a' | 11:20:01 AM
|
||||
minute | 'h:mm a' | 11:20 AM
|
||||
hour | 'hA' | 11AM
|
||||
day | 'MMM D' | Sep 4
|
||||
week | 'll' | Sep 4 2015
|
||||
month | 'MMM YYYY' | Sep 2015
|
||||
quarter | '[Q]Q - YYYY' | Q3 - 2015
|
||||
year | 'YYYY' | 2015
|
||||
|
||||
For example, to set the display format for the 'quarter' unit to show the month and year, the following config would be passed to the chart constructor.
|
||||
|
||||
@ -94,4 +94,4 @@ var chart = new Chart(ctx, {
|
||||
## Parser
|
||||
If this property is defined as a string, it is interpreted as a custom format to be used by moment to parse the date.
|
||||
|
||||
If this is a function, it must return a moment.js object given the appropriate data value.
|
||||
If this is a function, it must return a moment.js object given the appropriate data value.
|
||||
|
Loading…
Reference in New Issue
Block a user