Closed Bengt closed 11 months ago
Hi, @abidlabs!
I don't think that this feature should require a new component, but rather a new select
method on the existing Plot
class.
Note that these kinds of selections can be handled in Dash with for interactive graphing:
I'm not sure if our existing gr.Plot
class will be able to handle selections -- let's keep both options open right now and we'll think through it when we come around to this.
Sure. Thanks for reconsidering.
Hey! We've now made it possible for Gradio users to create their own custom components -- meaning that you can write some Python and JavaScript (Svelte), and publish it as a Gradio component. You can use it in your own Gradio apps, or share it so that anyone can use it in their Gradio apps. Here are some examples of custom Gradio components:
You can see the source code for those components by clicking the "Files" icon and then clicking "src". The complete source code for the backend and frontend is visible. In particular, its very fast if you want to build off an existing component. We've put together a Guide: https://www.gradio.app/guides/five-minute-guide, and we're happy to help. Hopefully this will help address this issue.
Is your feature request related to a problem? Please describe.
My Gradio application needs to respond to a selection made by the user in a Gradio Plot. While other components like textbox trigger a select event when the selected value changes, Plot objects do not offer such a callback.
Describe the solution you'd like
I would like a
.select()
event listener in the Plot class that triggers when the user selects something in a Plot object.Additional context
I have tried building a harness to determine which property changes in the plotly plot in the Gradio Plot object, but I did not succeed. Perhaps someone else can use this as a starting point:
Note that adding a selection works fine, as the output includes a
selections
field containing my dummy data:However, I cannot figure out how to listen to a change event on the selections.