Plotly data from API and custom dragelement function

Hi there

We’re using Plotlyjs and get the data from an API.
It’s a lot of data (and traces) with multiple y-axis.

The rendering works so far but the problem is, as soon as you zoom with the Dragelement it takes ages because plotly wants to scale the data by it’s own.

This doesn’t makes sense for our case because we want to get the new data from the API.
So we still want to use the new xaxis range from the dragelement event BUT somehow want to prevent the event and call relayout by our own.

I tried to modify the javascript code with something like PlotlyModule.plotlyjs.relayout = () => “my new layout function”, but this doesn’t have any effects!

(To understand why we do that is because the data is downsampled so when plotly zooms by it’s own the data is not correct, therefore we need to get it from the API)

Found the solution :slight_smile:

dragmode: ‘select’,
selectdirection: ‘h’

and then implement plotly_selected.

If you have any ohter solution, let me know.