I have a problem to update the options of a chart in react-chartjs-2, precisely in the dragData plugin of chartjs
I have the dragData activated for the graph, that part works, the graph allows you to drag the data. The problem occurs when I click the button to disable the drag option, the graph does not work, it still allows dragging the values.
apparently in the console the options of the graph change but it is not reflected in the interaction of the graph, I leave the code in the following link.
useEffect(() => {
if(props.state === true){
let ref = chartReference.current.chartInstance;
ref.options.dragData = false;
ref.update();
}else {
let ref = chartReference.current.chartInstance;
ref.options.dragData = true;
ref.update();
}
}, [props.state])