Dashboards mit Dash und Plotly erstellen
Alex Scriven
Data Scientist
Einige nützliche Anwendungen von Benutzereingaben:
number-Eingaben)search- oder text-Eingaben)password und email/text-Eingabe)
Eine Benutzereingabe ist ein Input-Typ der dash core components (dcc.Input)
id ist für die Callback-Integration erforderlichtype ist standardmäßig textplaceholder zeigt ausgegrauten Hinweistext
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
Das Argument type setzt automatisch einige Einschränkungen.
email das Format [email protected]dcc.Input(
id='my_input',
type='email',
placeholder="Enter your email")

number erlaubt nur Zahlenmin und max ZahlenlimitsminLength/maxLength für text-Eingabentext hat außerdem pattern für Regex-Validierung

dcc.Input(
id='my_input',
type='number',
max=250)
disabled deaktivieren
required erzwingen$$
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
Dashboards mit Dash und Plotly erstellen