Catalog npm
Back to packageRELEASE DETAILS

2.0.0

npm

@01coder/chartjs-plugin-selectdrag

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

brushchartjsdragrangeselect
Published16 Apr 2025
Direct dependencies2
Transitive dependenciesNot calculated

README

Current package documentation

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: []
}

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
chart.js
Environment
{
  "local_name": "chart.js",
  "alias": false,
  "peer_metadata": null
}
^4.4.8development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^4.8.2development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "607fabb99f5f8bfc8864b728300d2e62afbe8d52",
  "tarball": "https://registry.npmjs.org/@01coder/chartjs-plugin-selectdrag/-/chartjs-plugin-selectdrag-2.0.0.tgz",
  "fileCount": 10,
  "integrity": "sha512-rJTF39jqxeLbKaPyfBskQ0+hvbqzmyeAb59qLzk4QMbVHqyrynB6JZnU3Za/pgq+JsquDXWMlb/qRPcrNYu7CQ==",
  "signatures": [
    {
      "sig": "MEQCIDeNzHI/jD59nR6ykRn7qv02j0Xm0LjuTjp8yw75+FlWAiBKKWSye3Q/h8kwTsAywOcKLXSd0XAzyUhmN6BE9BO8HQ==",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 21761
}

Repository

PENDING
01codelt/chartjs-plugin-selectdrag

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:56 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:d975ff4f340e64be7d7d4cfeb6da84b205e720c4607fdde03d622c896b8946f4

Other collected versions

2.0.426 Aug2.0.32 Feb2.0.218 Nov2.0.113 May1.0.431 Mar1.0.35 FebView all collected versions →