artus9033 / chartjs-plugin-dragdata

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

dragging not working when usind parsing-option #124

Open StefanTurbine opened 1 year ago

StefanTurbine commented 1 year ago

Summary When using the parsing option to use other fields than 'y' inside the dataset the dragging is disabled. The events OnDragStart or OnDragEnd are occuring but the configured value is not changed.

Used Versions chart.js: 3.9.1 chartjs-plugin-dragdata: 2.2.5

Example Config { "type": "line", "data": { "datasets": [ { "label": "WIND", "data": [ { "uuid": "698b6560-7c25-465c-a707-8352f9e8caba", "x": "2020", "value": 46420430000, "percentage": 1 }, { "uuid": "708a69ef-eb98-4355-81a7-c3565cc33751", "x": "2025", "value": 50640580000, "percentage": 1.0909114801392403 }, { "uuid": "76ffaae8-255c-446f-8ff1-b3b258ec92a4", "x": "2030", "value": 54860980000, "percentage": 1.1818283458382441 }, { "uuid": "a8f1a128-f0e1-4c02-a216-b5b8e4ca82da", "x": "2035", "value": 66931110000, "percentage": 1.4418459716982372 } ], "backgroundColor": [ "rgba(255, 99, 132, 0.2)", "rgba(54, 162, 235, 0.2)", "rgba(255, 206, 86, 0.2)", "rgba(75, 192, 192, 0.2)", "rgba(153, 102, 255, 0.2)", "rgba(255, 159, 64, 0.2)" ], "borderColor": [ "rgba(255, 99, 132, 1)", "rgba(54, 162, 235, 1)", "rgba(255, 206, 86, 1)", "rgba(75, 192, 192, 1)", "rgba(153, 102, 255, 1)", "rgba(255, 159, 64, 1)" ], "borderWidth": 1 } ] }, "options": { "parsing": { "yAxisKey": "percentage" }, "responsive": true, "scales": { "y": { "dragData": true } }, "plugins": { "dragData": { "round": 1 }, "legend": { "position": "top" } } } }

Expected behavior It should be possible to drag the points :)