Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chartjs-plugin-dragdata

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartjs-plugin-dragdata

Draggable data points for Chart.js

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
increased by9.22%
Maintainers
1
Weekly downloads
 
Created
Source

chartjs-plugin-dragData.js

A plugin for Chart.js >= 2.4.0

Makes data points draggable. Supports touch events.

Drag Data Animation

Online demo single Y-Axis, dual Y-Axis,small chart,bubble chart.

Configuration

To make (line and bubble chart) data points draggable, simply add dragData: true to the config section of the chart instance. If you (additionally to the y-axis) would like to drag data along the x-axis, you may also add dragX: true.

Individual event listeners can be specified as follows:

{
  ...
  dragData: true,
  dragX: false,
  onDragStart: function (event, element) {

  },
  onDrag: function (event, datasetIndex, index, value) {

  },
  onDragEnd: function (event, datasetIndex, index, value) {

  }
}

When dragging data points towards the outer boundaries of the y-axis, one may experience unexptected (fast) changes to the y-axis scale. Therefore, depending on the use case, it may be recommended to fix the y-scale using similar options as follows (especially on small charts):

options: {
  scales: {
    yAxes: [{
      ticks: {
        max: 25,
        min: 0
      }
    }]
  },
  ...

Installation

To install via npm:

npm install chartjs-plugin-dragdata --save

Or, download a release archive file from the dist folder.

Contributing

Please feel free to submit an issue or a pull request!

License

chartjs-plugin-dragdata.js is available under the MIT license.

Keywords

FAQs

Package last updated on 02 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc