27 lines
469 B
Python
27 lines
469 B
Python
import plotly.graph_objects as go
|
|
from nicegui import ui
|
|
from random import random
|
|
|
|
|
|
ui.label('登录系统')
|
|
x = ui.input(label='x:')
|
|
y = ui.input(label='y:')
|
|
z = ui.input(label='z:')
|
|
|
|
|
|
|
|
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=[x.value, y.value, z.value]))
|
|
plot.update()
|
|
|
|
ui.button('Add trace', on_click=add_trace)
|
|
|
|
|
|
|
|
|
|
|
|
ui.run() |