-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathusage.py
49 lines (42 loc) · 1.33 KB
/
usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_pivottable
from data import data
app = dash.Dash(__name__)
app.title = 'My Dash example'
app.layout = html.Div([
dash_pivottable.PivotTable(
id='table',
data=data,
cols=['Day of Week'],
colOrder="key_a_to_z",
rows=['Party Size'],
rowOrder="key_a_to_z",
rendererName="Grouped Column Chart",
aggregatorName="Average",
vals=["Total Bill"],
valueFilter={'Day of Week': {'Thursday': False}}
),
html.Div(
id='output'
)
])
@app.callback(Output('output', 'children'),
[Input('table', 'cols'),
Input('table', 'rows'),
Input('table', 'rowOrder'),
Input('table', 'colOrder'),
Input('table', 'aggregatorName'),
Input('table', 'rendererName')])
def display_props(cols, rows, row_order, col_order, aggregator, renderer):
return [
html.P(str(cols), id='columns'),
html.P(str(rows), id='rows'),
html.P(str(row_order), id='row_order'),
html.P(str(col_order), id='col_order'),
html.P(str(aggregator), id='aggregator'),
html.P(str(renderer), id='renderer'),
]
if __name__ == '__main__':
app.run_server(debug=True)