# @01coder/chartjs-plugin-selectdrag

> Chartjs plugin which allows you to select a range of data by dragging over a chart

Latest version **2.0.4** (published 2026-08-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install @01coder/chartjs-plugin-selectdrag
pnpm add @01coder/chartjs-plugin-selectdrag
yarn add @01coder/chartjs-plugin-selectdrag
bun add @01coder/chartjs-plugin-selectdrag
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2026-08-26 |
| First published | 2022-09-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Luke Tinnion |
| Maintainers | 01coder |
| Keywords | chartjs, select, drag, range, brush |

## Links

- npm: https://www.npmjs.com/package/@01coder/chartjs-plugin-selectdrag
- Repository: https://github.com/01CodeLT/chartjs-plugin-selectdrag
- Homepage: https://github.com/01CodeLT/chartjs-plugin-selectdrag#readme
- Issues: https://github.com/01CodeLT/chartjs-plugin-selectdrag/issues
- npm.io page: https://npm.io/package/@01coder/chartjs-plugin-selectdrag

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2026-08-26
- 2.0.3 — 2026-02-02
- 2.0.2 — 2025-11-18
- 2.0.1 — 2025-05-13
- 2.0.0 — 2025-04-16
- 1.0.4 — 2025-03-31
- 1.0.3 — 2025-02-05
- 1.0.0 — 2022-09-08

## README

# Chart JS Plugin Select Drag
Chartjs plugin which allows you to select a range of data by dragging over a chart, see example https://stackblitz.com/edit/chartjs-selectdrag?file=index.html

### Usage

Register the plugin with chart js...
```
import Chart from "chart.js/auto";
import SelectDragPlugin from "@01coder/chartjs-plugin-selectdrag";
Chart.register(SelectDragPlugin);
```

Enable it in the settings of a chart
```
type: "bar",
options: {
  plugins: {
        selectdrag: {
            enabled: true,
            output: 'value', // Can be 'value' or 'label'
            highlight: false, // Highlight the selected data on the chart?
            colors: {
                selection: "#e8eff6", // Background color of selection box
                selected: "#1f77b4", // Color of selected data
                unselected: "#cccccc" // Color of unselected data
            },
            onSelectComplete: (event) => {
                // Show selected
                document.getElementById('results').innerHTML = event.range;

                // Get selected range
                console.log(event.range);
                
                // Get selection coordinates
                console.log(event.boundingBox);
            }
        }
    },
},
data: { 
    labels: [], 
    datasets: []
}
```

---
_Source: https://npm.io/package/@01coder/chartjs-plugin-selectdrag · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
