Skip to content

Commit cd44c86

Browse files
committed
document area line mark
1 parent 3829e99 commit cd44c86

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

docs/data/api.data.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function getHref(name: string, path: string): string {
5050
return `${path}s`;
5151
case "features/options":
5252
return "features/transforms";
53+
case "marks/areaLine":
54+
return "marks/area";
5355
case "marks/axis": {
5456
switch (name) {
5557
case "gridX":

docs/marks/area.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Plot.areaY(aapl, {x: "Date", y: "Close"}).plot()
2020

2121
The area mark has three constructors: [areaY](#areaY) for when the baseline and topline share *x* values, as in a time-series area chart where time goes right→ (or ←left); [areaX](#areaX) for when the baseline and topline share *y* values, as in a time-series area chart where time goes up↑ (or down↓); and lastly the rarely-used [area](#area) where the baseline and topline share neither *x* nor *y* values.
2222

23-
The area mark is often paired with a [line](./line.md) and [rule](./rule.md) mark to accentuate the topline and baseline.
23+
The **area line mark** <VersionBadge pr="2407" /> is a variant of the area mark that accentuates the topline. It is often paired with a [rule](./rule.md) mark for the baseline.
2424

2525
:::plot https://observablehq.com/@observablehq/plot-area-and-line
2626
```js
@@ -29,8 +29,7 @@ Plot.plot({
2929
grid: true
3030
},
3131
marks: [
32-
Plot.areaY(aapl, {x: "Date", y: "Close", fillOpacity: 0.3}),
33-
Plot.lineY(aapl, {x: "Date", y: "Close"}),
32+
Plot.areaLineY(aapl, {x: "Date", y: "Close"}),
3433
Plot.ruleY([0])
3534
]
3635
})
@@ -94,8 +93,7 @@ Plot.plot({
9493
reverse: true
9594
},
9695
marks: [
97-
Plot.areaY(aapl, {x: "Date", y: "Close", fillOpacity: 0.3}),
98-
Plot.lineY(aapl, {x: "Date", y: "Close"}),
96+
Plot.areaLineY(aapl, {x: "Date", y: "Close"}),
9997
Plot.ruleY([0])
10098
]
10199
})
@@ -111,8 +109,7 @@ Plot.plot({
111109
grid: true
112110
},
113111
marks: [
114-
Plot.areaX(aapl, {y: "Date", x: "Close", fillOpacity: 0.3}),
115-
Plot.lineX(aapl, {y: "Date", x: "Close"}),
112+
Plot.areaLineX(aapl, {y: "Date", x: "Close"}),
116113
Plot.ruleX([0])
117114
]
118115
})
@@ -128,8 +125,7 @@ Plot.plot({
128125
grid: true
129126
},
130127
marks: [
131-
Plot.areaY(aapl, {x: "Date", y: (d) => d.Date.getUTCMonth() < 3 ? NaN : d.Close, fillOpacity: 0.3}),
132-
Plot.lineY(aapl, {x: "Date", y: (d) => d.Date.getUTCMonth() < 3 ? NaN : d.Close}),
128+
Plot.areaLineY(aapl, {x: "Date", y: (d) => d.Date.getUTCMonth() < 3 ? NaN : d.Close}),
133129
Plot.ruleY([0])
134130
]
135131
})
@@ -326,6 +322,22 @@ Plot.areaX(observations, {y: "date", x: "temperature", interval: "day"})
326322

327323
The **interval** option is recommended to “regularize” sampled data; for example, if your data represents timestamped temperature measurements and you expect one sample per day, use "day" as the interval.
328324

325+
## areaLineY(*data*, *options*) {#areaLineY}
326+
327+
```js
328+
Plot.areaLineY(aapl, {x: "Date", y: "Close"})
329+
```
330+
331+
A variant of [areaY](#areaY) that accentuates the topline.
332+
333+
## areaLineX(*data*, *options*) {#areaLineX}
334+
335+
```js
336+
Plot.areaLineX(aapl, {y: "Date", x: "Close"})
337+
```
338+
339+
A variant of [areaX](#areaX) that accentuates the topline.
340+
329341
## area(*data*, *options*) {#area}
330342

331343
```js

0 commit comments

Comments
 (0)