Skip to content

Commit b426c13

Browse files
committed
Update README
1 parent d34af9d commit b426c13

File tree

1 file changed

+36
-14
lines changed

1 file changed

+36
-14
lines changed

README.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ In addition to the [standard style options](#marks), the area mark supports the
462462

463463
#### Plot.area(*data*, *options*)
464464

465-
Plot.area is rarely used directly; it is only needed when the baseline and topline have neither common *x* nor *y* values. [Plot.areaY](#plotareaydata-options) is used in the common horizontal orientation where the baseline and topline share *x* values, while [Plot.areaX](#plotareaxdata-options) is used in the vertical orientation where the baseline and topline share *y* values.
465+
Returns a new area with the given *data* and *options*. Plot.area is rarely used directly; it is only needed when the baseline and topline have neither common *x* nor *y* values. [Plot.areaY](#plotareaydata-options) is used in the common horizontal orientation where the baseline and topline share *x* values, while [Plot.areaX](#plotareaxdata-options) is used in the vertical orientation where the baseline and topline share *y* values.
466466

467467
#### Plot.areaX(*data*, *options*)
468468

@@ -508,7 +508,7 @@ Insets are typically used to ensure a one-pixel gap between adjacent bars; note
508508

509509
#### Plot.barX(*data*, *options*)
510510

511-
The following channels are required:
511+
Returns a new horizontal bar with the given *data* and *options*. The following channels are required:
512512

513513
* **x1** - the starting horizontal position; bound to the *x* scale
514514
* **x2** - the ending horizontal position; bound to the *x* scale
@@ -521,7 +521,7 @@ If an **x** option is specified, it is shorthand for the **x2** option with **x1
521521

522522
#### Plot.barY(*data*, *options*)
523523

524-
The following channels are required:
524+
Returns a new vertical bar with the given *data* and *options*. The following channels are required:
525525

526526
* **y1** - the starting vertical position; bound to the *y* scale
527527
* **y2** - the ending vertical position; bound to the *y* scale
@@ -570,15 +570,15 @@ Insets are typically used to ensure a one-pixel gap between adjacent cells; note
570570

571571
#### Plot.cell(*data*, *options*)
572572

573-
If both the **x** and **y** options are not specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
573+
Returns a new cell with the given *data* and *options*. If both the **x** and **y** options are not specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
574574

575575
#### Plot.cellX(*data*, *options*)
576576

577-
If the **x** option is not specified, it defaults to the identity function assuming that *data* = [*x₀*, *x₁*, *x₂*, …].
577+
Equivalent to Plot.cell, except that if the **x** option is not specified, it defaults to the identity function assuming that *data* = [*x₀*, *x₁*, *x₂*, …].
578578

579579
#### Plot.cellY(*data*, *options*)
580580

581-
If the **y** option is not specified, it defaults to the identity function assuming that *data* = [*y₀*, *y₁*, *y₂*, …].
581+
Equivalent to Plot.cell, except that if the **y** option is not specified, it defaults to the identity function assuming that *data* = [*y₀*, *y₁*, *y₂*, …].
582582

583583
### Dot
584584

@@ -608,15 +608,15 @@ TODO Describe how missing or invalid data is handled. Dots with a nonpositive ra
608608

609609
#### Plot.dot(*data*, *options*)
610610

611-
If both the **x** and **y** options are not specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
611+
Returns a new dot with the given *data* and *options. If both the **x** and **y** options are not specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
612612

613613
#### Plot.dotX(*data*, *options*)
614614

615-
If the **x** option is not specified, it defaults to the identity function assuming that *data* = [*x₀*, *x₁*, *x₂*, …].
615+
Equivalent to Plot.dot except that if the **x** option is not specified, it defaults to the identity function assuming that *data* = [*x₀*, *x₁*, *x₂*, …].
616616

617617
#### Plot.dotY(*data*, *options*)
618618

619-
If the **y** option is not specified, it defaults to the identity function assuming that *data* = [*y₀*, *y₁*, *y₂*, …].
619+
Equivalent to Plot.dot except that if the **y** option is not specified, it defaults to the identity function assuming that *data* = [*y₀*, *y₁*, *y₂*, …].
620620

621621
### Line
622622

@@ -648,25 +648,47 @@ In addition to the [standard style options](#marks), the line mark supports the
648648

649649
#### Plot.line(*data*, *options*)
650650

651-
If both the **x** and **y** options are not specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
651+
Returns a new line with the given *data* and *options*. If both the **x** and **y** options are not specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
652652

653653
#### Plot.lineX(*data*, *options*)
654654

655-
If the **x** option is not specified, it defaults to the identity function assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. If the **y** option is not specified, it defaults to [0, 1, 2, …].
655+
Equivalent to Plot.line except that if the **x** option is not specified, it defaults to the identity function assuming that *data* = [*x₀*, *x₁*, *x₂*, …]. If the **y** option is not specified, it defaults to [0, 1, 2, …].
656656

657657
#### Plot.lineY(*data*, *options*)
658658

659-
If the **y** option is not specified, it defaults to the identity function assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. If the **x** option is not specified, it defaults to [0, 1, 2, …].
659+
Equivalent to Plot.line except that if the **y** option is not specified, it defaults to the identity function assuming that *data* = [*y₀*, *y₁*, *y₂*, …]. If the **x** option is not specified, it defaults to [0, 1, 2, …].
660660

661661
### Link
662662

663663
[<img src="./img/link.png" width="320" height="198" alt="a chart with links">](https://observablehq.com/@data-workflows/plot-link)
664664

665-
[Source](./src/marks/link.js) · [Examples](https://observablehq.com/@data-workflows/plot-link)
665+
[Source](./src/marks/link.js) · [Examples](https://observablehq.com/@data-workflows/plot-link) · Draws line segments connecting pairs of points.
666+
667+
The following channels are required:
668+
669+
* **x1** - the starting horizontal position of the link; bound to the *x* scale
670+
* **y1** - the starting vertical position of the link; bound to the *y* scale
671+
* **x2** - the ending horizontal position of the link; bound to the *x* scale
672+
* **y2** - the ending vertical position of the link; bound to the *y* scale
673+
674+
The following optional channels are also supported:
675+
676+
* **z** - an ordinal value to control *z*-order (when overlapping)
677+
* **stroke** - a stroke color per series; bound to the *color* scale
678+
* **strokeOpacity** - a stroke opacity per series; bound to the *opacity* scale
679+
* **title** - a tooltip per series (a string of text, possibly with newlines)
680+
681+
The **stroke** and **strokeOpacity** options can be specified as either channels or constants. When the stroke is specified as a function or array, it is interpreted as a channel; when the stroke is specified as a string, it is interpreted as a constant if a valid CSS color and otherwise it is interpreted as a column name for a channel. Similarly when the stroke opacity is specified as a number, it is interpreted as a constant; otherwise it is interpeted as a channel.
682+
683+
TODO Describe the defaults for stroke.
684+
685+
TODO Describe how missing or invalid data is handled.
686+
687+
The link mark supports the [standard style options](#marks).
666688

667689
#### Plot.link(*data*, *options*)
668690

669-
691+
Returns a new link with the given *data* and *options*.
670692

671693
### Rect
672694

0 commit comments

Comments
 (0)