Dash Flashcards
What are the import calls?
dash
dash_core_components as dcc
dash_html_components as html
How do you create the app?
app = dash.Dash()
How do you create the layout?
app. layout = html.Div(children=[
html. H1(‘Hello Dash!’)
])
How do you force the app to taclab?
if __name__ == ‘__main__’:
app.run_server(debug=False,host="hkg3pl0790o.hk.hsbc",port=55555)
Can you add divisions within divisions?
Yes
How do you add a new dividions?
app.layout = html.Div(children=[
html. H1(‘Hello Dash!’),
html. Div(‘Dash: web dashboards’)
])
How do you code a graph using core components?
dcc.Graph(id = '', figure = { 'data':, 'layout'; }
How do you enter the data into dcc.Graph?
figure = { 'data' :[ {'x':[1,2,3], 'y':[4,1,2], 'type': 'bar', 'name': 'SF'} ], 'layout':{ 'title' : 'Bar plots' }
}
How do you affect styling of html components?
html.H1(‘Hello’, style = {‘textAlign’: ‘center’, ‘color’: ‘’})
How do you affect the styling of dash core components?
In the layout add a dictionary: 'layout':{ 'plot_bgcolor': '', 'paper_bgcolor':'', 'font':{'color':''}, 'title':''
}
How do you change the colour behind plot?
In layout, ‘plot_bgcolor’:
How do you change the background color of the dashboard?
In layout ‘paper_bgcolor’:
How do you generate a graph using plotly?
app.layout = html.Div( [dcc.Graph( id = 'scatterplot', figure = { 'data':[go.Scatter( x = rand_x, y = rand_y, mode = 'markers' )], 'layout':go.Layout(title = 'my scatter') }
)
]
)
What does dcc.Graph take when using plotly?
id =
figure =
Within figure there is a dictionary with ‘data’ and ‘layout’ as keys
Does html.Div take a list or a dictionary?
([])
Do the figure within dcc.Graph take a list or a dictionary?
Dictionary
dcc.Graph or dcc.graph
dcc.Graph
What does dcc.Graph take?
(), then figure = {}
How do you add x axis title?
xaxis = {‘title: ‘name’} within layout brackers
Does style for html.Div come within the [] or outside?
Outside
What does style take for html.Div
style = {‘color’:’green’}
If you want to insert multiple Div within each other, where do you place the next one?
Inside the division list you want to insert it in i.e. before style
What are the 2 parts you need for a dropdown?
html. Label(),
dcc. Dropdown()
What are 2 parts within dropdown?
dcc.Dropdown(
options =
value = )