Skip to content

Commit b228cd1

Browse files
committed
initial brush selection on all examples
1 parent 5dc545d commit b228cd1

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

docs/interactions/brush.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ The brush can be paired with reactive marks that respond to the brush state. Cre
8585
8686
A typical pattern is to layer three reactive marks: the inactive mark provides a default view, while the context and focus marks replace it during brushing, the context dimming unselected points and the focus highlighting selected ones.
8787
88-
:::plot defer hidden
88+
:::plot hidden
8989
```js
9090
Plot.plot({
91-
marks: ((brush) => [
91+
marks: ((brush) => (d3.timeout(() => brush.move({x1: 36, x2: 48, y1: 15, y2: 20})), [
9292
brush,
9393
Plot.dot(penguins, brush.inactive({x: "culmen_length_mm", y: "culmen_depth_mm", fill: "species", r: 2})),
9494
Plot.dot(penguins, brush.context({x: "culmen_length_mm", y: "culmen_depth_mm", fill: "#ccc", r: 2})),
9595
Plot.dot(penguins, brush.focus({x: "culmen_length_mm", y: "culmen_depth_mm", fill: "species", r: 3}))
96-
])(Plot.brush())
96+
]))(Plot.brush())
9797
})
9898
```
9999
:::
@@ -118,18 +118,18 @@ To achieve higher contrast, place the brush below the reactive marks; reactive m
118118
119119
The brush mark supports [faceting](../features/facets.md). When the plot uses **fx** or **fy** facets, each facet gets its own brush. Starting a brush in one facet clears any selection in other facets. The dispatched value includes the **fx** and **fy** facet values of the brushed facet, and the **filter** function also filters on the relevant facet values.
120120
121-
:::plot defer hidden
121+
:::plot hidden
122122
```js
123123
Plot.plot({
124124
height: 270,
125125
grid: true,
126-
marks: ((brush) => [
126+
marks: ((brush) => (d3.timeout(() => brush.move({x1: 43, x2: 50, y1: 17, y2: 19, fx: "Adelie"})), [
127127
Plot.frame(),
128128
brush,
129129
Plot.dot(penguins, brush.inactive({x: "culmen_length_mm", y: "culmen_depth_mm", fx: "species", fill: "sex", r: 2})),
130130
Plot.dot(penguins, brush.context({x: "culmen_length_mm", y: "culmen_depth_mm", fx: "species", fill: "#ccc", r: 2})),
131131
Plot.dot(penguins, brush.focus({x: "culmen_length_mm", y: "culmen_depth_mm", fx: "species", fill: "sex", r: 3}))
132-
])(Plot.brush())
132+
]))(Plot.brush())
133133
})
134134
```
135135
:::
@@ -153,18 +153,18 @@ For plots with a [geographic projection](../features/projections.md), the brush
153153
154154
<div v-if="land && cities.length">
155155
156-
:::plot defer hidden
156+
:::plot hidden
157157
```js
158158
Plot.plot({
159159
projection: "equal-earth",
160-
marks: ((brush) => [
160+
marks: ((brush) => (d3.timeout(() => brush.move({x1: 80, x2: 300, y1: 60, y2: 200})), [
161161
Plot.geo(land, {strokeWidth: 0.5}),
162162
Plot.sphere(),
163163
brush,
164164
Plot.dot(cities, brush.inactive({x: "longitude", y: "latitude", r: 2, fill: "#999"})),
165165
Plot.dot(cities, brush.context({x: "longitude", y: "latitude", r: 1, fill: "#999"})),
166166
Plot.dot(cities, brush.focus({x: "longitude", y: "latitude", r: 3, fill: "red"}))
167-
])(Plot.brush())
167+
]))(Plot.brush())
168168
})
169169
```
170170
:::

0 commit comments

Comments
 (0)