Skip to content

Commit 60b48f9

Browse files
committed
document differenceY
1 parent 54bf3fe commit 60b48f9

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

docs/marks/difference.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -122,28 +122,24 @@ In addition to the [standard mark options](../features/marks.md#mark-options), t
122122
* **x1** - the horizontal position of the comparison; bound to the *x* scale
123123
* **y1** - the vertical position of the comparison; bound to the *y* scale
124124

125-
If **x1** is not specified, it defaults to **x2**. If **y1** is not specified, it defaults to **y2** — TODO that’s not right, because **y1** defaults to zero for differenceY. These defaults facilitate sharing *x* or *y* coordinates between the metric and its comparison.
125+
If **x1** is not specified, it defaults to **x2**. If **y1** is not specified, it defaults to 0 if **x1** and **x2** are equal, and to **y2** otherwise. These defaults facilitate sharing *x* or *y* coordinates between the metric and its comparison.
126126

127-
TODO
127+
The standard option for **fill** is ignored and replaced with two channels:
128+
* **positiveFill** - the color for when the metric is greater, defaults to <span style="border-bottom:solid #01ab63 3px;">green</span>
129+
* **negativeFill** - the color for when the comparison is greater, defaults to <span style="border-bottom:solid #4269d0 3px;">blue</span>
128130

129-
* **fill**
130-
* **positiveFill**
131-
* **negativeFill**
132-
* **fillOpacity**
133-
* **positiveFillOpacity**
134-
* **negativeFillOpacity**
135-
* **stroke**
136-
* **strokeOpacity**
131+
* **fillOpacity** - the areas’ opacity, defaults to 1
132+
* **positiveFillOpacity** - the positive area’s opacity, defaults to *opacity*
133+
* **negativeFillOpacity** - the negative area’s opacity, defaults to *opacity*
134+
* **stroke** - the metric line’s stroke color, defaults to currentColor
135+
* **strokeOpacity** - the metric line’s opacity, defaults to 1
137136

138-
TODO
139-
140-
* **z**
141-
* **clip**
137+
These options are passed to the underlying area and line marks; in particular, when they are defined as a channel, the underlying marks are broken into contiguous overlapping segments when the values change. When any of these channels are used, setting an explicit **z** channel (possibly to null) is strongly recommended.
142138

143139
## differenceY(*data*, *options*) {#differenceY}
144140

145141
```js
146142
Plot.differenceY(gistemp, {x: "Date", y: "Anomaly"})
147143
```
148144

149-
TODO
145+
Returns a new difference with the given *data* and *options*. The mark is a composite mark consisting of a positive area, a negative area, and a line for the metric. The positive area extends from the bottom of the frame to the metric; it is clipped by an area extending from the comparison to the top of the frame. The negative area conversely extends from the top of the frame to the metric; it is clipped by an area extending from the comparison to the bottom of the frame.

0 commit comments

Comments
 (0)