chartjs-plugin-dragdata icon indicating copy to clipboard operation
chartjs-plugin-dragdata copied to clipboard

Vue3 compability

Open Mikolaj-Graja opened this issue 2 years ago • 3 comments
trafficstars

Events are not working on Vue3 (composition api)

Example:

const chartPlugins = [{
        id: 'mousedownCatcher',
        dragData: {
          round: 1,
          showTooltip: true,
          onDragStart: function (e, datasetIndex, index, value) {
            console.log(e)
          },
          onDrag: function (e, datasetIndex, index, value) {
            e.target.style.cursor = 'grabbing'
            console.log(e, datasetIndex, index, value)
          },
          onDragEnd: function (e, datasetIndex, index, value) {
            e.target.style.cursor = 'default'
            console.log(datasetIndex, index, value)
          },
        }
  }]

  const draggableChart = new Chart('draggableChart', {
        type: 'line',
        data: chartData,
        options: chartOptions,
        plugins: chartPlugins
  })
  + dragData: true on datasets in chartData

Result: no console logs, no changes in chart behaviour on click/ drag etc.

Plugin installed by npm

Mikolaj-Graja avatar Dec 12 '22 10:12 Mikolaj-Graja

Hey @Mikolaj-Graja,

Thanks for raising an issue. As always, I'd need a reproducible example on jsFiddle / Codesandbox etc. before having a deeper look.

chrispahm avatar Dec 12 '22 13:12 chrispahm

Can confirm I'm seeing the same issue: https://stackblitz.com/edit/nuxt-starter-2tb3jw?file=app.vue

bitbytebit1 avatar May 13 '23 02:05 bitbytebit1

Got it working: https://stackblitz.com/edit/nuxt-starter-2tb3jw?file=app.vue

bitbytebit1 avatar May 13 '23 19:05 bitbytebit1

Since @bitbytebit1's last comment with MWE demonstrates that Vue works properly, I'm closing this issue.

artus9033 avatar Aug 10 '24 14:08 artus9033