artus9033 / chartjs-plugin-dragdata

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

Show tooltips while dragging a data point #45

Closed chandruchiku closed 4 years ago

chandruchiku commented 4 years ago

It would be really helpful for the end user if we can show the tooltip while the point is being dragged so the user knows when to release.

chrispahm commented 4 years ago

Hey @chandruchiku! I think that's a really good idea.
Here's a fiddle of how that can be achieved: https://jsfiddle.net/nLt0m97s/5/

The approach uses an additional plugin for showing the tooltip that I found in this Chart.js issue. However, I think it would be useful to incorporate this feature in the main plugin (in order to be easier to use, and to avoid globals). I will think about a solution, but would also be happy about pull requests 😄

Best Christoph

chrispahm commented 4 years ago

Alright, I just made a new release! All examples are updated to use the new feature (=> showing the tooltip while dragging) https://chrispahm.github.io/chartjs-plugin-dragdata/

You can enable the setting by adding

dragOptions: {
  showTooltip: true
},

to the Chart.options. I also recommend to add some dragDataRound value.

Best Christoph

chandruchiku commented 4 years ago

I was working on a PR myself. But you got that done already. Thanks :)

chrispahm commented 4 years ago

Ok sorry for that! I just thought the feature would help my own projects as well so I added it right away! Thanks again for bringing this up 👍