-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs update code in viz_folder #916
base: master
Are you sure you want to change the base?
Changes from 10 commits
8227e63
5b46d24
9b8c598
f6b78c0
a0423cc
0781007
daa6e65
7d8733a
3d2ddb9
5c9d15e
2bcf2e8
a2c5625
ad04dad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's also a couple There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! I already fix these issues, if there is still any problem, please let me know. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,46 +18,54 @@ | |||||||||||||||||||||
|
||||||||||||||||||||||
@solara.component | ||||||||||||||||||||||
def Page(): | ||||||||||||||||||||||
with solara.VBox() as main: | ||||||||||||||||||||||
selection_data, set_selection_data = solara.use_state(None) | ||||||||||||||||||||||
click_data, set_click_data = solara.use_state(None) | ||||||||||||||||||||||
hover_data, set_hover_data = solara.use_state(None) | ||||||||||||||||||||||
unhover_data, set_unhover_data = solara.use_state(None) | ||||||||||||||||||||||
deselect_data, set_deselect_data = solara.use_state(None) | ||||||||||||||||||||||
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species") | ||||||||||||||||||||||
solara.FigurePlotly( | ||||||||||||||||||||||
fig, on_selection=set_selection_data, on_click=set_click_data, on_hover=set_hover_data, on_unhover=set_unhover_data, on_deselect=set_deselect_data | ||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
solara.Markdown( | ||||||||||||||||||||||
f""" | ||||||||||||||||||||||
state = solara.use_reactive( | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
"selection_data": None, | ||||||||||||||||||||||
"click_data": None, | ||||||||||||||||||||||
"hover_data": None, | ||||||||||||||||||||||
"unhover_data": None, | ||||||||||||||||||||||
"deselect_data": None, | ||||||||||||||||||||||
} | ||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species") | ||||||||||||||||||||||
solara.FigurePlotly( | ||||||||||||||||||||||
fig, | ||||||||||||||||||||||
on_selection=lambda data: state.value.update({"selection_data": data}), | ||||||||||||||||||||||
on_click=lambda data: state.value.update({"click_data": data}), | ||||||||||||||||||||||
on_hover=lambda data: state.value.update({"hover_data": data}), | ||||||||||||||||||||||
on_unhover=lambda data: state.value.update({"unhover_data": data}), | ||||||||||||||||||||||
on_deselect=lambda data: state.value.update({"deselect_data": data}), | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||
) | ||||||||||||||||||||||
|
||||||||||||||||||||||
solara.Markdown( | ||||||||||||||||||||||
f""" | ||||||||||||||||||||||
# Events data | ||||||||||||||||||||||
## selection | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
{selection_data} | ||||||||||||||||||||||
{state.value['selection_data']} | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
## click | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
{click_data} | ||||||||||||||||||||||
{state.value['click_data']} | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
## hover | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
{hover_data} | ||||||||||||||||||||||
{state.value['hover_data']} | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
## unhover | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
{unhover_data} | ||||||||||||||||||||||
{state.value['unhover_data']} | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
## deselect | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
{deselect_data} | ||||||||||||||||||||||
{state.value['deselect_data']} | ||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
""" | ||||||||||||||||||||||
) | ||||||||||||||||||||||
return main | ||||||||||||||||||||||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should convert these to
use_reactive
as well.