pikaa
pikaa
SSolara
Created by pikaa on 7/26/2024 in #questions-issues
any upcoming plans/existing ways to create guided tour functionality (solara)?
i'm interested in creating a guided tour for my app. are there any sort of upcoming plans to try and implement something like this, or would there be a way i could leverage something like this as a vue component to implement it? not sure exactly how to include/import the vue library within solara's context and get started with it, so any help/guidance would be appreciated
4 replies
SSolara
Created by pikaa on 3/10/2024 in #questions-issues
Plotly FigureWidget axes do not reset ranges within solara's render context
Upon applying an effect to set autorange=True to a figure with autorange='reversed', the Figure does not return to the original axes orientation. I'm wondering what happens behind the scenes here for the render when the use_effect is triggered. I can upload a ipynb with its expected behaviour within a jupyter context vs its behaviour in solara. The partial code (can give complete if needed). plotstate contains 2 reactives for flipx and flipy.
def imshowfig()
def create_fig():
z, cmin, cmax = perform_binning()
fig = px.imshow(z.T,
zmin=cmin,
zmax=cmax,
origin="lower",
color_continuous_scale="inferno")
return fig

# only instantiate the figure once
figure = sl.use_memo(create_fig, dependencies=[])

def add_effects(fig_element: sl.Element):

def set_xflip():
print("setting xflip", plotstate.flipx.value)
fig_widget: FigureWidget = sl.get_widget(fig_element)
if plotstate.flipx.value:
fig_widget.update_xaxes(autorange="reversed")
else:
fig_widget.update_xaxes(autorange=True)
print(fig_widget.layout.xaxis)

def set_yflip():
print("setting yflip", plotstate.flipy.value)
fig_widget: FigureWidget = sl.get_widget(fig_element)
if plotstate.flipy.value:
fig_widget.update_yaxes(autorange="reversed")
else:
fig_widget.update_yaxes(autorange=True)
print(fig_widget.layout.yaxis)

sl.use_effect(set_xflip, dependencies=[plotstate.flipx.value])
sl.use_effect(set_yflip, dependencies=[plotstate.flipy.value])

fig_el = sl.FigurePlotly(figure)
add_effects(fig_el)
def imshowfig()
def create_fig():
z, cmin, cmax = perform_binning()
fig = px.imshow(z.T,
zmin=cmin,
zmax=cmax,
origin="lower",
color_continuous_scale="inferno")
return fig

# only instantiate the figure once
figure = sl.use_memo(create_fig, dependencies=[])

def add_effects(fig_element: sl.Element):

def set_xflip():
print("setting xflip", plotstate.flipx.value)
fig_widget: FigureWidget = sl.get_widget(fig_element)
if plotstate.flipx.value:
fig_widget.update_xaxes(autorange="reversed")
else:
fig_widget.update_xaxes(autorange=True)
print(fig_widget.layout.xaxis)

def set_yflip():
print("setting yflip", plotstate.flipy.value)
fig_widget: FigureWidget = sl.get_widget(fig_element)
if plotstate.flipy.value:
fig_widget.update_yaxes(autorange="reversed")
else:
fig_widget.update_yaxes(autorange=True)
print(fig_widget.layout.yaxis)

sl.use_effect(set_xflip, dependencies=[plotstate.flipx.value])
sl.use_effect(set_yflip, dependencies=[plotstate.flipy.value])

fig_el = sl.FigurePlotly(figure)
add_effects(fig_el)
6 replies