Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

[Feature] Single click anywhere in a Graph #861

Open
sleighsoft opened this issue Sep 4, 2020 · 13 comments
Open

[Feature] Single click anywhere in a Graph #861

sleighsoft opened this issue Sep 4, 2020 · 13 comments

Comments

@sleighsoft
Copy link
Contributor

sleighsoft commented Sep 4, 2020

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

@alexcjohnson
Copy link
Collaborator

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 plotly/plotly.js#2696

@sleighsoft
Copy link
Contributor Author

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

@sleighsoft
Copy link
Contributor Author

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?

@alexcjohnson
Copy link
Collaborator

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

@sleighsoft
Copy link
Contributor Author

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:)

@FabSN
Copy link

FabSN commented Jun 21, 2021

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

@sleighsoft
Copy link
Contributor Author

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

@FabSN
Copy link

FabSN commented Jun 22, 2021

Is it possible to share it please ?

@FabSN
Copy link

FabSN commented Jun 28, 2021

@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

@sleighsoft
Copy link
Contributor Author

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

@flaviofusero
Copy link

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.

@sleighsoft
Copy link
Contributor Author

What did you adapt @flaviofusero ?

@flaviofusero
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants