Skip to content

Updating individual attributes like color attribute of a plot card dynamically #1831

Answered by mturoci
n-srinidhi asked this question in Q&A
Discussion options

You must be logged in to vote

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 t…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@n-srinidhi
Comment options

Comment options

You must be logged in to vote
2 replies
@n-srinidhi
Comment options

@vopani
Comment options

Answer selected by n-srinidhi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants