Comments (4)
Interesting request. Thanks for sharing the code, @Voltini
So, if we had this capability, once we set color=np.random.choice(["a", "b"], N)
, and you clicked on point 'b', the result you'd expect would be: 'marker.color': 'b'
?
from dash.
Hi Adam. Exactly, that's what I was thinking!
from dash.
Thank you for this feature request, @Voltini .
Can you please share a MRE with the scatter plots you mention?
from dash.
Sure, take for example the following code:
from dash import Dash, html, dcc, Input, Output
import plotly.express as px
import numpy as np
app = Dash(__name__)
N = 10
app.layout = html.Div(
[
html.Div(
children=[
dcc.Graph(
figure=px.scatter(
x=np.random.random(N),
y=np.random.random(N),
color=np.random.choice(["a", "b"], N),
),
id="plot",
)
],
),
html.Div(id="example", children="Hello World"),
],
)
@app.callback(Output("example", "children"), Input("plot", "clickData"))
def call(clickdata):
return str(clickdata)
if __name__ == "__main__":
app.run(debug=True)
When I click on a point I get:
{'points': [{'curveNumber': 0, 'pointNumber': 3, 'pointIndex': 3, 'x': 0.23940095437991715, 'y': 0.3631388501979541, 'bbox': {'x0': 605.27, 'x1': 611.27, 'y0': 260.14, 'y1': 266.14}}]}
However, if I change the color parameter in my plot to color=np.random.random(N)
I get:
{'points': [{'curveNumber': 0, 'pointNumber': 4, 'pointIndex': 4, 'x': 0.11509044553896275, 'y': 0.41656166816663565, 'marker.color': 0.39641498810036235, 'bbox': {'x0': 329.76, 'x1': 335.76, 'y0': 270.62, 'y1': 276.62}}]}
As you can see now I have a marker.color
attribute that was not present when my data was categorical.
Edit: Also it seems that the frontend already has access to the desired infromation, I don't know if this comment helps.
from dash.
Related Issues (20)
- [Feature Request] Exporting the dev tool callback graph in a standardized graph format
- [BUG] Use of `dash_duo` hangs Github Action until Timeout HOT 1
- [BUG] dbc.Modal(style) is passed to fade-modal-show layer instead modal HOT 1
- [BUG] Persistence failed in component type props
- [BUG] The dash component generation doesn't work for hyphenated props HOT 1
- [BUG] no_update is not allowed as an output to set_progress for background progress
- feat: show electrical ground symbol or similar for callbacks with no output
- [Feature Request] Is there any way to set the local and global effects of dash's callback? HOT 3
- Dropdown changes in Dash 2.17 causing page loading issues in Dash docs
- Dash 2.17.0 prevents some generated App Studio apps from running
- [BUG] set_props called multiple times only keep the last props.
- [BUG] Cannot get Dev Tools to work inside of ASGI / FastAPI application HOT 4
- [BUG] Patch += operation not working on the patch object.
- 便宜机场推荐:2024最新便宜机场
- [BUG] Fix overlay_style in dcc.Loading
- Exception: Access Denied HOT 3
- [BUG] callback dataflow display flickers at certain sizes HOT 6
- [BUG] running does not support wildcards in ids HOT 1
- [Feature Request] Make it possible to disable docstring generation when generating components
- [BUG] No output callbacks with clientside_callback
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash.