|
@@ -0,0 +1,21 @@
|
|
|
+from nicegui import ui
|
|
|
+
|
|
|
+
|
|
|
+def main_demo() -> None:
|
|
|
+ from random import random
|
|
|
+
|
|
|
+ echart = ui.echart({
|
|
|
+ 'xAxis': {'type': 'value'},
|
|
|
+ 'yAxis': {'type': 'category', 'data': ['A', 'B'], 'inverse': True},
|
|
|
+ 'legend': {'textStyle': {'color': 'gray'}},
|
|
|
+ 'series': [
|
|
|
+ {'type': 'bar', 'name': 'Alpha', 'data': [0.1, 0.2]},
|
|
|
+ {'type': 'bar', 'name': 'Beta', 'data': [0.3, 0.4]},
|
|
|
+ ],
|
|
|
+ })
|
|
|
+
|
|
|
+ def update():
|
|
|
+ echart.options['series'][0]['data'][0] = random()
|
|
|
+ echart.update()
|
|
|
+
|
|
|
+ ui.button('Update', on_click=update)
|