Updating individual attributes like color attribute of a plot card dynamically #1831
-
Hi!I am currently implementing a plot card in a Wave web app dashboard. I would like to change the colour of the plot_card on certain events like when the toggle button is toggled.
so when the toggle button is clicked, I would like to change the color attribute through code, something like this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@mturoci This will be nice to support if possible. I couldn't do this without redrawing the whole |
Beta Was this translation helpful? Give feedback.
-
Hm.. can you try this code? from h2o_wave import main, app, Q, ui, data
@app('/')
async def serve(q: Q):
q.page['example'] = ui.plot_card(
box='1 1 4 5',
title='Line',
data=data('year value', 8, rows=[
('1991', 3),
('1992', 4),
('1993', 3.5),
('1994', 5),
('1995', 4.9),
('1996', 6),
('1997', 7),
('1998', 9),
('1999', 13),
]),
plot=ui.plot([ui.mark(type='line', x_scale='time', x='=year', y='=value', color='$red', y_min=0)])
)
await q.page.save()
q.page['example'].plot.marks[0].color = '$blue'
await q.page.save() seems to do the job for me. cc @vopani |
Beta Was this translation helpful? Give feedback.
Hm.. can you try this code?
seems t…