Skip to content

Commit 4ed2a99

Browse files
committed
move crosshair to interactions
1 parent 357ac3d commit 4ed2a99

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Plot.plot({
6565

6666
The pointer interaction supports both two-dimensional (pointer) and one-dimensional (pointerX and pointerY) pointing modes. Above, one-dimensional pointing is used for a time-series chart to find the closest *x*-value; below, two-dimensional pointing is used for a scatterplot to find the closest point in *x* and *y*.
6767

68-
The pointer interaction also powers the new [crosshair mark](https://observablehq.com/plot/marks/crosshair) which shows the *x* (horizontal↔︎ position) and *y* (vertical↕︎ position) value of the point closest to the pointer on the bottom and left sides of the frame, respectively.
68+
The pointer interaction also powers the new [crosshair mark](https://observablehq.com/plot/interactions/crosshair) which shows the *x* (horizontal↔︎ position) and *y* (vertical↕︎ position) value of the point closest to the pointer on the bottom and left sides of the frame, respectively.
6969

7070
<img src="./img/crosshair-dot.webp" width="640" alt="A scatterplot of penguins, comparing culmen depth (y) and culmen length (x); a pointer moves around the chart highlighting the x and y values of the closest point.">
7171

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export default defineConfig({
8080
{text: "Box", link: "/marks/box"},
8181
{text: "Cell", link: "/marks/cell"},
8282
{text: "Contour", link: "/marks/contour"},
83-
{text: "Crosshair", link: "/marks/crosshair"},
8483
{text: "Delaunay", link: "/marks/delaunay"},
8584
{text: "Density", link: "/marks/density"},
8685
{text: "Dot", link: "/marks/dot"},
@@ -126,6 +125,7 @@ export default defineConfig({
126125
text: "Interactions",
127126
collapsed: true,
128127
items: [
128+
{text: "Crosshair", link: "/interactions/crosshair"},
129129
{text: "Pointer", link: "/interactions/pointer"}
130130
]
131131
}

docs/features/interactions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Plot.dot(olympians, {
3737
```
3838
:::
3939

40-
The [crosshair mark](../marks/crosshair.md) uses the pointer transform internally to display a [rule](../marks/rule.md) and a [text](../marks/text.md) showing the **x** (horizontal↔︎ position) and **y** (vertical↕︎ position) value of the nearest data.
40+
The [crosshair mark](../interactions/crosshair.md) uses the pointer transform internally to display a [rule](../marks/rule.md) and a [text](../marks/text.md) showing the **x** (horizontal↔︎ position) and **y** (vertical↕︎ position) value of the nearest data.
4141

4242
:::plot defer
4343
```js

docs/interactions/pointer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ onMounted(() => {
2323

2424
# Pointer transform
2525

26-
The **pointer transform** filters a mark interactively such that only the point closest to the pointer is rendered. It is typically used to show details on hover, often with a [tip](../marks/tip.md) or [crosshair](../marks/crosshair.md) mark, but it can be paired with any mark.
26+
The **pointer transform** filters a mark interactively such that only the point closest to the pointer is rendered. It is typically used to show details on hover, often with a [tip](../marks/tip.md) or [crosshair](./crosshair.md) mark, but it can be paired with any mark.
2727

2828
To demonstrate, below the pointer transform filters a filled <span style="border-bottom: solid 2px var(--vp-c-red);">red</span> dot behind a stroked <span style="border-bottom: solid 2px currentColor;">{{ $dark ? "white" : "black"}}</span> dot. As you hover the chart, only the closest red dot to the pointer is rendered. If you remove the pointer transform by toggling the checkbox, all the red dots will be visible.
2929

docs/marks/crosshair.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import penguins from "../data/penguins.ts";
1010

1111
# Crosshair mark
1212

13-
The **crosshair mark** shows the *x* (horizontal↔︎ position) and *y* (vertical↕︎ position) value of the point closest to the [pointer](../interactions/pointer.md) on the bottom and left sides of the frame, respectively.
13+
The **crosshair mark** shows the *x* (horizontal↔︎ position) and *y* (vertical↕︎ position) value of the point closest to the [pointer](./pointer.md) on the bottom and left sides of the frame, respectively.
1414

1515
:::plot defer
1616
```js
@@ -23,7 +23,7 @@ Plot.plot({
2323
```
2424
:::
2525

26-
For charts which have a “dominant” dimension, such as time in a time-series chart, use the crosshairX or crosshairY mark for the [pointerX](../interactions/pointer.md#pointerx-options) or [pointerY](../interactions/pointer.md#pointery-options) transform as appropriate.
26+
For charts which have a “dominant” dimension, such as time in a time-series chart, use the crosshairX or crosshairY mark for the [pointerX](./pointer.md#pointerx-options) or [pointerY](./pointer.md#pointery-options) transform as appropriate.
2727

2828
:::plot defer
2929
```js
@@ -62,7 +62,7 @@ Plot.plot({
6262
```
6363
:::
6464

65-
The crosshair mark does not currently support any format options; values are displayed with the default format. If you are interested in this feature, please upvote [#1596](https://github.com/observablehq/plot/issues/1596). In the meantime, you can implement a custom crosshair using the [pointer transform](../interactions/pointer.md) and a [text mark](./text.md).
65+
The crosshair mark does not currently support any format options; values are displayed with the default format. If you are interested in this feature, please upvote [#1596](https://github.com/observablehq/plot/issues/1596). In the meantime, you can implement a custom crosshair using the [pointer transform](./pointer.md) and a [text mark](../marks/text.md).
6666

6767
## Crosshair options
6868

0 commit comments

Comments
 (0)