-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusage.py
46 lines (35 loc) · 1.18 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
import dashgrid
import dash
import dash_html_components as html
import pandas as pd
app = dash.Dash('')
app.css.append_css({"external_url": "https://cdnjs.cloudflare.com/ajax/libs/ag-grid/12.0.2/styles/ag-grid.css"})
app.css.append_css({"external_url": "https://cdnjs.cloudflare.com/ajax/libs/ag-grid/12.0.2/styles/theme-fresh.css"})
app.scripts.config.serve_locally = True
def transformDataframe(df):
cdef = [{"headerName": x, "field": x} for x in list(df)]
rdata = df.to_dict("records")
return cdef, rdata
cdef, rdata = transformDataframe(pd.read_csv("sampledata.csv"))
app.layout = html.Div([
dashgrid.GridComponent(
id='input',
columnDefs=cdef,
rowData=rdata,
gridWidth=1000,
gridHeight=1000,
enableColResize=True,
autoSizeColumns=True,
enableSorting=True,
enableFilter=True,
# domLayout="autoHeight"
),
html.Div(id='output')
])
# @app.callback(
# dash.dependencies.Output('output', 'children'),
# [dash.dependencies.Input('input', 'value')])
# def display_output(value):
# return 'You have entered {}'.format(value)
if __name__ == '__main__':
app.run_server(debug=True)