Skip to content

Commit 04b220e

Browse files
committed
Update README
1 parent 202c95c commit 04b220e

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

README.md

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,58 +1357,30 @@ If *curve* is a function, it will be invoked with a given *context* in the same
13571357

13581358
The tension option only has an effect on cardinal and Catmull–Rom splines (*cardinal*, *cardinal-open*, *cardinal-closed*, *catmull-rom*, *catmull-rom-open*, and *catmull-rom-closed*). For cardinal splines, it corresponds to [tension](https://github.com/d3/d3-shape/blob/master/README.md#curveCardinal_tension); for Catmull–Rom splines, [alpha](https://github.com/d3/d3-shape/blob/master/README.md#curveCatmullRom_alpha).
13591359

1360-
1361-
13621360
## Formats
13631361

13641362
These helper functions are provided for use as a *scale*.tickFormat [axis option](#position-options), as the text option for [Plot.text](#plottextdata-options), or for general use. See also [d3-time-format](https://github.com/d3/d3-time-format) and JavaScript’s built-in [date formatting](https://observablehq.com/@mbostock/date-formatting) and [number formatting](https://observablehq.com/@mbostock/number-formatting).
13651363

13661364
#### Plot.formatIsoDate(*date*)
13671365

1368-
Given a Date, returns the [shortest equivalent ISO 8601 UTC string](https://github.com/mbostock/isoformat/).
1369-
13701366
```js
1371-
Plot.formatIsoDate(new Date(Date.UTC(2001, 0, 1))) // "2001-01-01"
1372-
Plot.formatIsoDate(new Date(Date.UTC(2020, 0, 1, 12, 23))) // "2020-01-01T12:23Z"
1367+
Plot.formatIsoDate(new Date("2020-01-01T00:00.000Z")) // "2020-01-01"
13731368
```
13741369

1375-
#### Plot.formatWeekday(*locale*, *format*)
1370+
Given a *date*, returns the shortest equivalent ISO 8601 UTC string.
13761371

1377-
Returns a function that formats a week day number (from 0 = Sunday to 6 = Saturday) according to the *locale* and *format*.
1378-
- *locale*: any valid [BCP 47 language tag](https://tools.ietf.org/html/bcp47); defaults to "en-US". Use navigator.language to respect the browser’s setting.
1379-
- *format*: any valid [weekday format](https://tc39.es/ecma402/#datetimeformat-objects), *i.e.* one of "narrow", "short", "long"; defaults to "short".
1380-
1381-
```js
1382-
x: { tickFormat: Plot.formatWeekday() } // Sun, Mon…
1383-
```
1384-
1385-
```js
1386-
Plot.formatWeekday("es-MX", "long") // domingo, lunes…
1387-
```
1372+
#### Plot.formatWeekday(*locale*, *format*)
13881373

13891374
```js
1390-
Plot.formatWeekday(navigator.language, "long") // depends on the browser’s settings
1375+
Plot.formatWeekday("es-MX", "long")(0) // "domingo"
13911376
```
13921377

1393-
This function is periodic: day -1 is Saturday, and day 8 is Sunday.
1378+
Returns a function that formats a given week day number (from 0 = Sunday to 6 = Saturday) according to the specified *locale* and *format*. The *locale* is a [BCP 47 language tag](https://tools.ietf.org/html/bcp47) and defaults to U.S. English. The *format* is a [weekday format](https://tc39.es/ecma402/#datetimeformat-objects): either *narrow*, *short*, or *long*; if not specified, it defaults to *short*.
13941379

13951380
#### Plot.formatMonth(*locale*, *format*)
13961381

1397-
Returns a function that formats a month number (from 0 = January to 11 = December) according to the *locale* and *format*.
1398-
- *locale*: any valid [BCP 47 language tag](https://tools.ietf.org/html/bcp47); defaults to "en-US". Use navigator.language to respect the browser’s setting.
1399-
- *format*: any valid [month format](https://tc39.es/ecma402/#datetimeformat-objects), *i.e.* one of "2-digit", "numeric", "narrow", "short", "long"; defaults to "short".
1400-
1401-
```js
1402-
x: { tickFormat: Plot.formatMonth() } // Jan, Feb…
1403-
```
1404-
14051382
```js
1406-
Plot.formatMonth("es-MX", "long") // enero, febrero…
1383+
Plot.formatMonth("es-MX", "long")(0) // "enero"
14071384
```
14081385

1409-
```js
1410-
Plot.formatMonth(navigator.language, "long") // depends on the browser’s settings
1411-
```
1412-
1413-
This function is periodic: month -1 is December, and month 12 is January.
1414-
1386+
Returns a function that formats a given month number (from 0 = January to 11 = December) according to the specified *locale* and *format*. The *locale* is a [BCP 47 language tag](https://tools.ietf.org/html/bcp47) and defaults to U.S. English. The *format* is a [month format](https://tc39.es/ecma402/#datetimeformat-objects): either *2-digit*, *numeric*, *narrow*, *short*, *long*; if not specified, it defaults to *short*.

0 commit comments

Comments
 (0)