Created
March 26, 2021 17:27
-
-
Save mtanco/4b39b58a75a886e9786325b3300be342 to your computer and use it in GitHub Desktop.
This example script explores how to display stat cards nicely on a layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from h2o_wave import main, site, Q, ui | |
def create_stat_card(name: str, n: int): | |
page[name] = ui.tall_gauge_stat_card( | |
box=ui.box(zone='body', width='200px', height='200px'), | |
title='test '*n, | |
value=str(n), | |
aux_value=str(n*100), | |
progress=n*0.1, | |
plot_color='purple', | |
data=None, | |
commands=None | |
) | |
page = site['/'] | |
page['meta'] = ui.meta_card( | |
box='', | |
title='Stat Gauges', | |
layouts=[ | |
ui.layout( | |
breakpoint='xl', | |
width='1200px', | |
zones=[ | |
ui.zone( | |
name='body', # use this for all tall_gauge_stat_cards | |
direction='row', # place cards as rows or columns | |
wrap='start', # wrap overflow to next line | |
), | |
] | |
) | |
] | |
) | |
for i in range(14): | |
create_stat_card(f'card_{i}', i) | |
page.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment