artus9033 / chartjs-plugin-dragdata

Draggable data points plugin for Chart.js
MIT License
261 stars 55 forks source link

[Question] Possibility to drag a set of points #46

Closed yoelz55 closed 4 years ago

yoelz55 commented 4 years ago

Hi, first of all, thank you for this amazing plugin.

I have a simple question, it is possible when dragging a point to drag a set of points?

Example: if I have 100 points in the graph and by dragging one I want to drag the 5 points that surrounds the selected points.

Thanks in advance,

chrispahm commented 4 years ago

Hey @yoelz55,

thanks for the ❤️

So regarding your question: it is indeed possible to drag multiple points at once. That's one of the main reasons for using the onDragStart and onDrag callbacks. I made you a small (and somewhat ugly) fiddle, but I think it illustrates how you can achieve this: https://jsfiddle.net/45nurh9L/3/

A similar question has been asked in the past, you might also find it helpful to look at the solution posted there: https://github.com/chrispahm/chartjs-plugin-dragdata/issues/22

Hope this helps Christoph

yoelz55 commented 4 years ago

Thank you for your response and your fiddle 💯

I got it 👍