JSPM

chartjs-plugin-select

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q47232F
  • License MIT

A chartjs plugin to provide drag select based callbacks on charts.

Package Exports

  • chartjs-plugin-select

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (chartjs-plugin-select) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

chartjs-plugin-select npm downloads

A Chartjs plugin to provide drag select event callbacks.

This is inspired mostly from https://github.com/chartjs/Chart.js/issues/5283.

Usage

In chart options, supply the following:

select: {
  events: ['mousedown', 'mouseup'], // this is important!
  selectCallback: (startPoint, endPoint) => {
    /*
      Callback after drag select has completed.
    */
  }
}

Doc

selectCallback

This is called after mouse point is released at the end of select.

  • startPoint: is the next closest point from where the mouse is pressed.
  • endPoint: is the last point where the mouse point in released. Point is represented by [index of fataset, x-pos of data point, y-pos of data point]

Advantages of using this plugin

  • Limitless... :-)

Limitations

  • I have tested this only on a line chart

Follow this repo for updates.