Passing data from Plotly to my web application

Hi, i’m new to plotly and i’m trying to run a flask application with a plotly library. The thing is i want to define a range between the x-axis and the y-axis with box selection and pass the data of the ranges (x_min, x_max) to my flask application. It’s possible do that with the library of plotly and flask or i need more tools?

Hi @Verack,

You can use the Plotly.js plotly_selected callback to get the selection box extents in JavaScript: https://plot.ly/javascript/plotlyjs-events/#select-event. But if you want to get that information back to the Python backend you would need to transfer that yourself somehow.

Of, you could consider using Dash (which is itself based on Flask). If you try out the first example at https://dash.plot.ly/interactive-graphing, you can use the box selection tool and see the callback information that Dash receives in response.

Hope that helps!
-Jon

1 Like

Thanks for the answer, i’m going to use Dash instead

1 Like