Skip to content

Commit 349233c

Browse files
committed
Update CHANGELOG
1 parent 932f24f commit 349233c

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,28 @@ The new *clip* mark option enables clipping to the plot frame. For example, this
2020
d3.ticks(0, max, bands).map(t => Plot.areaY(traffic, {x: "date", y: d => d.value - t, fill: () => t, clip: true}))
2121
```
2222

23-
Warnings…
23+
Plot can now generate helpful warnings for common mistakes. Warnings are indicated by a warning sign ⚠️ in the top-right corner of the plot; open your browser’s developer console to read the warnings. For example, if you forget to parse strings to dates, resulting in an *ordinal* scale rather than the desired *utc* scale, Plot will advise on how to fix the scale definition.
24+
25+
<img src="./img/warning.png" width="640" alt="a horizon chart of unemployment rates by metro area; increases are shown in red, and decreases in blue">
26+
27+
```js
28+
Plot.line(aapl, {x: "Date", y: "Close"}).plot({y: {type: "linear", grid: true}}) // 🌶 Oops, Date and Close are strings!
29+
```
30+
31+
This warning is:
32+
33+
> Warning: some data associated with the x scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "point" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the x scale to "point".
34+
35+
We will add [more warnings](https://github.com/observablehq/plot/issues/755) in the future. If Plot did something you didn’t expect, please let us know; perhaps it will inspire a new warning that will help other users.
2436

2537
The [text mark](./README.md#text) now supports automatic wrapping! The new **lineWidth** option specifies the desired length of a line in ems. The line breaking, wrapping, and text metrics implementations are all rudimentary, but they should be acceptable for text that is mostly ASCII. (For more control, you can hard-wrap text manually.) The **monospace** option now provides convenient defaults for monospaced text.
2638

39+
<img src="./img/wrap.png" width="640" alt="a snippet of Moby Dick, demonstrating Plot’s line wrapping implementation">
40+
41+
```js
42+
Plot.text([mobydick], {dx: 6, dy: 6, fontSize: 12, lineWidth: 80, lineHeight: 1.2, frameAnchor: "top-left", monospace: true})
43+
```
44+
2745
Plot now supports ARIA attributes for improved accessibility: aria-label, aria-description, aria-hidden. The top-level **ariaLabel** and **ariaDescription** options apply to the root SVG element. The new **ariaLabel** and **ariaDescription** scale options apply to axes; the label defaults to *e.g.* “y-axis” and the description defaults to the scale’s label (*e.g.*, “↑ temperature”). Marks define a group-level aria-label (*e.g.*, “dot”). There is also an optional **ariaLabel** channel for labeling data (*e.g.*, “E 12.7%”), and a group-level **ariaDescription** option for a human-readable description. The **ariaHidden** mark option allows the hiding of decorative elements from the accessibility tree.
2846

2947
The line and link marks now support [marker options](./README.md#markers) for drawing a graphical marker (such as a dot or arrowhead) on each vertex. Circle and arrow markers are provided, or you can implement a custom marker function that returns an SVG marker element. Markers automatically inherit the stroke color of the associated mark.

img/warning.png

103 KB
Loading

img/wrap.png

234 KB
Loading

0 commit comments

Comments
 (0)