dash-core-components icon indicating copy to clipboard operation
dash-core-components copied to clipboard

[Feature] Single click anywhere in a Graph

Open sleighsoft opened this issue 5 years ago • 13 comments

Is there currently an API that registers a single click on a Graph and sends coordinate information back to the server?

I would like to implement a feature where I can single click anywhere in a Graph and add a vertical line that spans from y=0 to whatever max(y) is.

I would appreciate any pointers towards useful resources.

If there is no such feature I would also be willing to contribute it to dash-core-components if there is interest.

Also see: https://community.plotly.com/t/mouse-click-position-anywhere-on-plot-canvas/10870 https://community.plotly.com/t/get-mouses-position-on-click/4145

sleighsoft avatar Sep 04 '20 18:09 sleighsoft

This would need to be added to plotly.js first - and has come up many times over there. We'd love to have this feature, it just hasn't yet risen to the top. If you're eager to dig one level deeper @sleighsoft we'd love to help the PR through :) See eg https://github.com/plotly/plotly.js/issues/2696

alexcjohnson avatar Sep 04 '20 19:09 alexcjohnson

Thank you @alexcjohnson for pointing me in the right direction. I will definitely give it a shot

sleighsoft avatar Sep 05 '20 06:09 sleighsoft

Is there a way how I can make dash-core-components use a local installation of plotly.js? So that I can make changes to plotly.js and test them in dash-core-components and or in my own custom ploltly Python app?

sleighsoft avatar Sep 06 '20 18:09 sleighsoft

Point assets_folder of the dash app to the folder the plotly.js bundle was generated in, and dcc will use that.

alexcjohnson avatar Sep 06 '20 22:09 alexcjohnson

Thank you @alexcjohnson

If you are familiar with the JavaScript part of plotly, would you mind taking a look into the issue you referenced where I requested/hoped for some more help/guidance. I would greatly appreciate it:)

sleighsoft avatar Sep 07 '20 17:09 sleighsoft

Hello, @sleighsoft , do you have a working issue for this problem ? I'm looking for the same feature on Dash graph. Thanks

FabSN avatar Jun 21 '21 20:06 FabSN

I do have working code. Just not the time to fully test it unfortunately. No guarantees on an eta too currently

sleighsoft avatar Jun 22 '21 15:06 sleighsoft

Is it possible to share it please ?

FabSN avatar Jun 22 '21 19:06 FabSN

@sleighsoft , can you share it please ? Thanks.

I do have working code. Just not the time to fully test it unfortunately. No guarantees on an eta too currently

FabSN avatar Jun 28 '21 20:06 FabSN

There is this work by me. However, it has been pending for a while now. https://github.com/plotly/plotly.js/pull/5443

I may find some time over the weekend to make progress on it, but no promises

sleighsoft avatar Sep 09 '21 13:09 sleighsoft

There is this work by me. However, it has been pending for a while now. plotly/plotly.js#5443

I may find some time over the weekend to make progress on it, but no promises

Thanks a lot sleighsoft. I have been looking for this for a while and an adaptation of your implementation seems to work for me.

flaviofusero avatar Sep 12 '21 09:09 flaviofusero

What did you adapt @flaviofusero ?

sleighsoft avatar Sep 13 '21 07:09 sleighsoft

Sorry, bad wording from my side. I didn't change anything in your logic, I just adapted your code to whatever I needed in my project.

flaviofusero avatar Sep 14 '21 06:09 flaviofusero