Creare dashboard con Dash e Plotly
Alex Scriven
Data Scientist
Alcuni usi utili degli input utente:
number)search o text)password e email/text)
Un input utente è un Input di dash core components (dcc.Input)
id per l'integrazione nel callbacktype predefinito è textplaceholder mostra un testo guida in grigio
dcc.Input(
id='my_input',
type='text',
placeholder="Enter your text")
# @callback()
def update_plot(entered_data):
fig = px.scatter(
data_frame=sales,
y='OrderValue', x='Quantity',
, title=f'{entered_data}')
return fig
'text', 'number', 'password', 'email''range' crea uno slider di intervallo'tel' e 'url' per numeri di telefono e URL di siti web'search' e 'hidden' richiedono interazioni avanzate del browser
L'argomento type imposta automaticamente alcune limitazioni.
email richiede il formato [email protected]dcc.Input(
id='my_input',
type='email',
placeholder="Enter your email")

number accetta solo numerimin e max impostano limiti numericiminLength / maxLength per input texttext ha anche pattern per la validazione regex

dcc.Input(
id='my_input',
type='number',
max=250)
disabled
required$$
dcc.Input()

dcc.Input(id='my_input', disabled=True)

dcc.Input(id='my_input', required=True)
$$
dcc.Input(id='my_input', type='text',
debounce=False)
$$
R, Re, Red, Redd
Creare dashboard con Dash e Plotly