15 lines
364 B
Python
15 lines
364 B
Python
import plotly.graph_objects as go
|
|
from nicegui import ui
|
|
from random import random
|
|
|
|
fig = go.Figure()
|
|
fig.update_layout(margin=dict(l=0, r=0, t=0, b=0))
|
|
plot = ui.plotly(fig).classes('w-full h-40')
|
|
|
|
def add_trace():
|
|
fig.add_trace(go.Scatter(x=[1, 2, 3], y=[random(), random(), random()]))
|
|
plot.update()
|
|
|
|
ui.button('Add trace', on_click=add_trace)
|
|
|
|
ui.run() |