Skip to content

Commit 0c5e7e8

Browse files
committed
Update CHANGELOG
1 parent 6fa49fa commit 0c5e7e8

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,32 @@ Plot.plot({
2020

2121
The [line](./README.md#line) and [area](./README.md#area) marks (specifically lineX, lineY, areaX, and areaY) now support an implicit [bin transform](./README.md#bin) with the **interval** option. This can be used to “regularize” time series data, say to show gaps or default to zero when data is missing, rather than interpolating across missing data. This is also useful for stacking time series data that is sampled at irregular intervals or with missing samples.
2222

23+
<img src="./img/sparse-series.png" width="640" alt="a time-series area chart showing downloads per day with gaps for missing data">
24+
25+
```js
26+
Plot.plot({
27+
marks: [
28+
Plot.lineY(downloads, {x: "date", y: "downloads", interval: d3.utcDay, curve: "step"}),
29+
Plot.areaY(downloads, {x: "date", y: "downloads", interval: d3.utcDay, fill: "#eee", curve: "step"}),
30+
Plot.ruleY([0])
31+
]
32+
})
33+
```
34+
35+
The default **reduce** is *first*, picking the first value in each interval. By using *sum* instead, we can default to zero when data is missing (and add values if the data contains more than one observation per day).
36+
37+
<img src="./img/dense-series.png" width="640" alt="a time-series area chart showing downloads per day with zeroes for missing data">
38+
39+
```js
40+
Plot.plot({
41+
marks: [
42+
Plot.lineY(downloads, {x: "date", y: "downloads", interval: d3.utcDay, reduce: "sum", curve: "step"}),
43+
Plot.areaY(downloads, {x: "date", y: "downloads", interval: d3.utcDay, reduce: "sum", fill: "#eee", curve: "step"}),
44+
Plot.ruleY([0])
45+
]
46+
})
47+
```
48+
2349
The [bin transform](./README.md#bin) now coerces the input channel (the quantity being binned) to numbers as necessary. In addition, the bin transform now correctly handles typed array input channels representing temporal data.
2450

2551
The [stack transform](./README.md#stack) now allows the **offset** option to be specified as a function. For example, this can be used to visualize Likert survey results with a neutral category as a diverging stacked bar chart.

img/dense-series.png

14 KB
Loading

img/sparse-series.png

15.2 KB
Loading

0 commit comments

Comments
 (0)