artus9033 / chartjs-plugin-dragdata

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

With tooltips disabled, TypeError: Cannot read property 'update' of undefined #84

Closed artus9033 closed 2 years ago

artus9033 commented 2 years ago

There is a bug if the chart is configured to have disabled tooltips (options: { plugins: { tooltip: { enabled: false } } }):


chartjs-plugin-dragdata.js:1531 Uncaught TypeError: Cannot read property 'update' of undefined
    at Object.beforeEvent (chartjs-plugin-dragdata.js:1531)
    at callback (helpers.segment.js:92)
    at PluginService._notify (chart.esm.js:4922)
    at PluginService.notify (chart.esm.js:4909)
    at Chart.notifyPlugins (chart.esm.js:6047)
    at Chart._eventHandler (chart.esm.js:6069)
    at Chart.update (chart.esm.js:5641)
    at updateData (chartjs-plugin-dragdata.js:1476)
    at HTMLCanvasElement.<anonymous> (chartjs-plugin-dragdata.js:1524)
    at Dispatch.call (chartjs-plugin-dragdata.js:63)```

It seems like the call there does not check whether `chart.tooltip` is nullish.
chrispahm commented 2 years ago

Good find @artus9033! Issues like this one constantly remind me of why I need to work on #40... Also thanks for the PR, will merge ASAP

chrispahm commented 2 years ago

Published in 2.2.4