Dash Flashcards

1
Q

What are the import calls?

A

dash
dash_core_components as dcc
dash_html_components as html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you create the app?

A

app = dash.Dash()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you create the layout?

A

app. layout = html.Div(children=[
html. H1(‘Hello Dash!’)

])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you force the app to taclab?

A

if __name__ == ‘__main__’:

 app.run_server(debug=False,host="hkg3pl0790o.hk.hsbc",port=55555)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Can you add divisions within divisions?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you add a new dividions?

A

app.layout = html.Div(children=[

html. H1(‘Hello Dash!’),
html. Div(‘Dash: web dashboards’)

])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you code a graph using core components?

A
dcc.Graph(id = '',
figure = {
'data':,
'layout';
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you enter the data into dcc.Graph?

A
figure = {
'data' :[
{'x':[1,2,3], 'y':[4,1,2], 'type': 'bar', 'name': 'SF'}
],
'layout':{
'title' : 'Bar plots'
}

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you affect styling of html components?

A

html.H1(‘Hello’, style = {‘textAlign’: ‘center’, ‘color’: ‘’})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you affect the styling of dash core components?

A
In the layout add a dictionary:
'layout':{
'plot_bgcolor': '',
'paper_bgcolor':'',
'font':{'color':''},
'title':''

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you change the colour behind plot?

A

In layout, ‘plot_bgcolor’:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you change the background color of the dashboard?

A

In layout ‘paper_bgcolor’:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you generate a graph using plotly?

A
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') 
    }

)

]
)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does dcc.Graph take when using plotly?

A

id =
figure =

Within figure there is a dictionary with ‘data’ and ‘layout’ as keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Does html.Div take a list or a dictionary?

A

([])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Do the figure within dcc.Graph take a list or a dictionary?

A

Dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

dcc.Graph or dcc.graph

A

dcc.Graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does dcc.Graph take?

A

(), then figure = {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do you add x axis title?

A

xaxis = {‘title: ‘name’} within layout brackers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Does style for html.Div come within the [] or outside?

A

Outside

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What does style take for html.Div

A

style = {‘color’:’green’}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

If you want to insert multiple Div within each other, where do you place the next one?

A

Inside the division list you want to insert it in i.e. before style

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are the 2 parts you need for a dropdown?

A

html. Label(),

dcc. Dropdown()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are 2 parts within dropdown?

A

dcc.Dropdown(
options =
value = )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is within options within dropdown?
A list, then a dictionary for each item with label and value | options = [{'label': 'New York','value':'NYC'}, {'label':'San Fran': 'value': 'SF'}]
26
For a slider, what are the inputs?
min max step value
27
Does a slider take a list or not?
dcc.Slider(min = , max = )
28
How do you add a legend to the slider?
marks = {i: i for i in range(-10,10)}
29
Does marks take () or {} in dcc.Slider
{}
30
What does radioitems take?
options = [{}] with label and value key pairs
31
How do you add a gap between items?
Either wrap in a div or do html.P around one item
32
How do you display text in a more interesting way?
dcc.Markdown(children = variablewithtextin)
33
How do you get bold text
**bold**
34
How do you get italics?
*italics*
35
how do you get links?
[links](linkhere)
36
How do you get headers?
Header
37
What do you have to enclose the markdown text within?
''' text here '''
38
app.layout or app.Layout
app.layout
39
style = {} or style: {}
style = {}
40
Is the style inside or outside the square bracket?
Outside
41
What are the imports for interactive callsbacks?
from dash.dependencies import Input,Output
42
What is the format for dcc input?
dcc.Input(id='my-id', value='initial value', type='text'),
43
How do you define a formula That takes a text input and returns it?
``` def update_output_div(input_value): return 'You\'ve entered "{}"'.format(input_value) ```
44
What is the callback structure?
@app.callback( Output(component_id='my-div', component_property='children'), [Input(component_id='my-id', component_property='value')]
45
What is the component property for output?
Children
46
What is the component property for input?
Value
47
What goes into dcc.Input?
id = value = type =
48
What are the entries in Input and Output
Output(component_id='my-div', component_property='children'), [Input(component_id='my-id', component_property='value')]
49
How do you get an html.Div go go side by side?
style = {'display':'inline-block'}
50
How do you force the width of a div?
style = {'width': '48%'}
51
style = {'width': 48%} or style = {'width': '48%'}
style = {'width': '48%'}
52
Where do you set the color of the graph?
px.scatter(color=)
53
What does state take?
What you would have put in input
54
How do you import bootstrap?
import dash_bootstrap_components as dbc
55
How do you force app to use bootstrap?
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
56
What goes inside what? columns or rows?
columns go inside rows
57
How many columns are there by default?
12
58
What ist he code for rows and columns?
dbc. Row() | dbc. Col()
59
How do you change the width of columns / rows?
dbc.Row(dbc.Col( html.H3('hello'),with = {'size': 6, 'offset': 3}))
60
What are keys within width dictionary?
size, offset, order
61
What are the options to input within size for width?
1 - 12, auto, True. Auto will expand to how ever much it needs to
62
What does width belong to?
dbd.Col(width = {})