-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Expand file tree
/
Copy pathapp.py
More file actions
57 lines (49 loc) · 1.57 KB
/
app.py
File metadata and controls
57 lines (49 loc) · 1.57 KB
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
50
51
52
53
54
55
56
57
from dash import Dash, html, Input, Output
import dash_pivottable
from data.data import data
from utils.components import header
app = Dash(__name__, title="Dash Pivottable")
server = app.server
app.layout = html.Div([
header(app, "black", "Dash PivotTable"),
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"),
],
className="app-body")
])
@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):
"""
This callback demonstrates how to access the properties of the PivotTable, which can then be used as needed.
"""
return [
html.H3("PivotTable parameters:"),
html.P("cols: " + str(cols)),
html.P("rows: " + str(rows)),
html.P("row_order: " + str(row_order)),
html.P("col_order: " + str(col_order)),
html.P("aggregator: " + str(aggregator)),
html.P("renderer: " + str(renderer)),
]
if __name__ == "__main__":
app.run_server(debug=True)