TODAY learn how to bring Drag & Drop to Dash with Dashboard Engine. 🌠 Sign up for the live event!

Plotly Reactjs Linear/Bar Graph

myPlot.on(‘plotly_click’, function(data){

            console.log(data)

            for(var i=0; i<data.points.length; i++){

                annotate_text = 'x = '+data.points[i].x +' y = '+data.points[i].y.toPrecision(4);

                annotation = {

                    text: annotate_text,

                    x: data.points[i].x,

                    y: parseFloat(data.points[i].y.toPrecision(4))

                }

                annotations = self.layout.annotations || [];

                annotations.push(annotation);

                Plotly.relayout('myDiv',{annotations: annotations})

            }

        });

how to use plotly_click event in reactjs?