Skip to content

Commit

Permalink
gods tree & barycentric fix (#1729)
Browse files Browse the repository at this point in the history
* gods

* fix barycentric

* Update CHANGELOG

---------

Co-authored-by: Mike Bostock <mbostock@gmail.com>
  • Loading branch information
Fil and mbostock authored Jun 27, 2023
1 parent 0579f2e commit ac5b227
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
31 changes: 20 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,34 @@ Plot.plot({
})
```

The [tree mark](https://observablehq.com/plot/marks/tree) now supports a **textLayout** option, which defaults to *mirrored*, alternating the orientation of labels for internal (non-leaf) *vs.* external (leaf) nodes. The treeNode and treeLink marks now also support a new **treeFilter** option, allowing these marks to be filtered (without affecting the tree layout).
The [tree mark](https://observablehq.com/plot/marks/tree) now supports a **textLayout** option, which defaults to *mirrored* to alternate the orientation of labels for internal (non-leaf) *vs.* external (leaf) nodes. The treeNode and treeLink marks now also support a new **treeFilter** option, allowing these marks to be filtered without affecting the tree layout.

[TK Example of mirrored labels in a tree diagram.]
<img src="./img/tree-gods.png" width="640" alt="A small family tree diagram of Greek gods. Chaos beget Eros, Erebus, Tartarus, and Gaia; Gaia beget Mountains, Pontus, and Uranus.">

The [tip mark](https://observablehq.com/plot/marks/tip) now automatically sets the pointer-events attribute to *none* when associated with the [pointer transform](https://observablehq.com/plot/interactions/pointer) when the the pointer is not sticky, as when hovering a chart without clicking to lock the pointer. This prevents the tip mark from interfering with interaction on other marks, such as clickable links.

Fix [barycentric interpolation](https://observablehq.com/plot/marks/raster#interpolatorbarycentric-options) outside the convex hull of samples.
```js
Plot.plot({
axis: null,
height: 100,
margin: 10,
marginLeft: 40,
marginRight: 120,
marks: [
Plot.tree(gods, {textStroke: "white"})
]
})
```

[TK Before and after comparison of barycentric interpolation.]
The [barycentric interpolator](https://observablehq.com/plot/marks/raster#interpolatorbarycentric-options) now behaves correctly outside the convex hull of samples. The new algorithm (below right) radiates outwards from the hull, ensuring a continuous image; the old algorithm (below left) radiated inwards from values imputed on the frame’s edges, producing discontinuities.

TK Fix invisible rects with the [auto mark](https://observablehq.com/plot/marks/auto) when both dimensions are ordinal and the **mark** option is set to *bar*.
<img src="./img/barycentric-before-after.png" width="632" alt="A before-and-after comparison of the barycentric interpolator applied to three sample points; in the new algorithm, lines radiate outward perpendicular from the triangle’s sides, producing a more coherent and understandable image.">

TK Fix pointer transform on non-faceted marks in faceted plots.
The [tip mark](https://observablehq.com/plot/marks/tip) now automatically sets the pointer-events attribute to *none* when associated with the [pointer transform](https://observablehq.com/plot/interactions/pointer) when the the pointer is not sticky, as when hovering a chart without clicking to lock the pointer. This prevents the tip mark from interfering with interaction on other marks, such as clickable links.

TK Fix a regression with the [window transform](https://observablehq.com/plot/transforms/window) when using the *median*, *deviation*, *variance*, or percentile reducer.
The [auto mark](https://observablehq.com/plot/marks/auto) now renders as a cell, instead of a degenerate invisible rect, when **x** and **y** are both ordinal and the **mark** option is set to *bar*. The [tree mark](https://observablehq.com/plot/marks/tree) no longer produces duplicate tips with the **tip** option. The [rule mark](https://observablehq.com/plot/marks/rule) now respects the top-level **document** option, if any, when using the **clip** option.

Fix the **clip** option when the [rule mark](https://observablehq.com/plot/marks/rule) is used with a custom **document**. Fix the **tip** option with the [tree mark](https://observablehq.com/plot/marks/tree) to not produce duplicate tips.
The **title**, **ariaLabel**, and **href** channels no longer filter by default; these channels may now be sparsely defined and the associated mark instance will still render.

The **title**, **ariaLabel**, and **href** channels no longer filter by default. These channels may now be sparsely defined and the associated mark instance will still render.
The [pointer transform](https://observablehq.com/plot/interactions/pointer) now handles non-faceted marks in faceted plots. The [window transform](https://observablehq.com/plot/transforms/window)’s *median*, *deviation*, *variance*, and percentile reducers have been fixed.

## 0.6.8

Expand Down
2 changes: 1 addition & 1 deletion docs/marks/tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Plot.plot({
axis: null,
height: 100,
margin: 10,
marginLeft: 35,
marginLeft: 40,
marginRight: 120,
marks: [
Plot.tree(gods, {textStroke: "var(--vp-c-bg)"})
Expand Down
Binary file added img/barycentric-before-after.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/tree-gods.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ac5b227

Please sign in to comment.