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
Q

What is within options within dropdown?

A

A list, then a dictionary for each item with label and value

options = [{‘label’: ‘New York’,’value’:’NYC’}, {‘label’:’San Fran’: ‘value’: ‘SF’}]

26
Q

For a slider, what are the inputs?

A

min
max
step
value

27
Q

Does a slider take a list or not?

A

dcc.Slider(min = , max = )

28
Q

How do you add a legend to the slider?

A

marks = {i: i for i in range(-10,10)}

29
Q

Does marks take () or {} in dcc.Slider

A

{}

30
Q

What does radioitems take?

A

options = [{}] with label and value key pairs

31
Q

How do you add a gap between items?

A

Either wrap in a div or do html.P around one item

32
Q

How do you display text in a more interesting way?

A

dcc.Markdown(children = variablewithtextin)

33
Q

How do you get bold text

A

bold

34
Q

How do you get italics?

A

italics

35
Q

how do you get links?

A
36
Q

How do you get headers?

A

Header

37
Q

What do you have to enclose the markdown text within?

A

’’’ text here ‘’’

38
Q

app.layout or app.Layout

A

app.layout

39
Q

style = {} or style: {}

A

style = {}

40
Q

Is the style inside or outside the square bracket?

A

Outside

41
Q

What are the imports for interactive callsbacks?

A

from dash.dependencies import Input,Output

42
Q

What is the format for dcc input?

A

dcc.Input(id=’my-id’, value=’initial value’, type=’text’),

43
Q

How do you define a formula That takes a text input and returns it?

A
def update_output_div(input_value):
return 'You\'ve entered "{}"'.format(input_value)
44
Q

What is the callback structure?

A

@app.callback(
Output(component_id=’my-div’, component_property=’children’),
[Input(component_id=’my-id’, component_property=’value’)]

45
Q

What is the component property for output?

A

Children

46
Q

What is the component property for input?

A

Value

47
Q

What goes into dcc.Input?

A

id =
value =
type =

48
Q

What are the entries in Input and Output

A

Output(component_id=’my-div’, component_property=’children’),
[Input(component_id=’my-id’, component_property=’value’)]

49
Q

How do you get an html.Div go go side by side?

A

style = {‘display’:’inline-block’}

50
Q

How do you force the width of a div?

A

style = {‘width’: ‘48%’}

51
Q

style = {‘width’: 48%} or style = {‘width’: ‘48%’}

A

style = {‘width’: ‘48%’}

52
Q

Where do you set the color of the graph?

A

px.scatter(color=)

53
Q

What does state take?

A

What you would have put in input

54
Q

How do you import bootstrap?

A

import dash_bootstrap_components as dbc

55
Q

How do you force app to use bootstrap?

A

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])

56
Q

What goes inside what? columns or rows?

A

columns go inside rows

57
Q

How many columns are there by default?

A

12

58
Q

What ist he code for rows and columns?

A

dbc. Row()

dbc. Col()

59
Q

How do you change the width of columns / rows?

A

dbc.Row(dbc.Col( html.H3(‘hello’),with = {‘size’: 6, ‘offset’: 3}))

60
Q

What are keys within width dictionary?

A

size, offset, order

61
Q

What are the options to input within size for width?

A

1 - 12, auto, True. Auto will expand to how ever much it needs to

62
Q

What does width belong to?

A

dbd.Col(width = {})