Skip to content
Back to skills

2264 Interactions Bd35d476

ASecurity

Plot provides interactive features for data exploration through pointing, tooltips, and the pointer transform.

  • 9 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 31, 2026
developmentjavascriptjavareactgit

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 2264-interactions_bd35d476 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2264 Interactions Bd35d476?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2264 Interactions Bd35d476
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2264-interactions-bd35d476/badge)](https://www.skillsdirectory.com/skills/tools-only-2264-interactions-bd35d476)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Interactions

Plot provides interactive features for data exploration through pointing, tooltips, and the pointer transform.

## Quick Tooltips

The simplest way to add interactivity:

```javascript
Plot.dot(data, {x: "x", y: "y", tip: true}).plot()
```

## Tip Mark

For more control over tooltips:

```javascript
Plot.plot({
  marks: [
    Plot.line(data, {x: "date", y: "value"}),
    Plot.tip(data, Plot.pointer({x: "date", y: "value"}))
  ]
})
```

## Pointer Transform

Filters to show only the nearest data point:

```javascript
// Two-dimensional (scatter plots)
Plot.pointer(options)

// X-dominant (time series)
Plot.pointerX(options)

// Y-dominant
Plot.pointerY(options)
```

### Example

```javascript
Plot.plot({
  marks: [
    Plot.line(data, {x: "date", y: "value"}),
    Plot.dot(data, Plot.pointerX({x: "date", y: "value", fill: "red"}))
  ]
})
```

## Crosshair Mark

Displays x and y values along axes:

```javascript
Plot.plot({
  marks: [
    Plot.line(data, {x: "date", y: "value"}),
    Plot.crosshair(data, {x: "date", y: "value"})
  ]
})
```

### Variants

```javascript
Plot.crosshair(data, options)   // Both axes
Plot.crosshairX(data, options)  // X-axis focused
Plot.crosshairY(data, options)  // Y-axis focused
```

## Pointer Options

| Option | Default | Description |
|--------|---------|-------------|
| `px`, `py` | - | Target position |
| `maxRadius` | 40 | Maximum pointing distance |
| `frameAnchor` | middle | Target within frame |

## Click to Stick

Clicking on a point locks the tooltip until clicked again, allowing text selection.

## Input Events

Pointer transforms emit input events:

```javascript
const plot = Plot.dot(data, Plot.pointer({x: "x", y: "y"})).plot();

plot.addEventListener("input", () => {
  console.log(plot.value);  // Currently focused datum
});
```

## Custom Reactivity

Update plots by replacing them:

```javascript
function updatePlot(filteredData) {
  const newPlot = Plot.plot({
    marks: [Plot.dot(filteredData, {x: "x", y: "y"})]
  });
  oldPlot.replaceWith(newPlot);
}
```

### React Integration

```jsx
function Chart({ data }) {
  const ref = useRef();

  useEffect(() => {
    const plot = Plot.plot({
      marks: [Plot.dot(data, {x: "x", y: "y", tip: true})]
    });
    ref.current.replaceChildren(plot);
    return () => plot.remove();
  }, [data]);

  return <div ref={ref} />;
}
```

## Future Features

Under development (see GitHub issues):
- **Selection**: Direct manipulation point selection (#5)
- **Zooming**: Pan and zoom (#1590)
- **Animation**: Declarative animation (#166)

## Notes

- Use `tip: true` for quick tooltips
- Use `Plot.pointer` with custom marks for more control
- `pointerX` is best for time series
- `pointerY` is best for horizontal charts
- Pointer transform still contributes to scale domains

Files in this skill

  • README.md865 B
  • skill.md2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.