Skip to content

Commit 049125a

Browse files
committed
using dash bootstrap components
1 parent 2a08e0c commit 049125a

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

dash_waveform/app.py

+29-27
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
import dash
2+
import dash_bootstrap_components as dbc
23
import dash_core_components as dcc
34
import dash_html_components as html
45
import dash_table
56
import pandas as pd
67
from dash.dependencies import Input, Output
78

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

9-
app = dash.Dash(__name__)
10-
app.css.append_css({"external_url": "https://codepen.io/chriddyp/pen/bWLwgP.css"})
1111

12-
13-
df = pd.DataFrame({"time": [1, 2, 4], "values": [10, 20, 15]})
14-
15-
app.layout = html.Div(
12+
row = html.Div(
1613
[
17-
html.Div(
14+
dbc.Row(dbc.Col(html.Div("Waveform editor"))),
15+
dbc.Row(
1816
[
19-
html.Div(
20-
[
21-
dash_table.DataTable(
22-
id="table-editing-simple",
23-
columns=[{"name": i, "id": i} for i in df.columns],
24-
data=df.to_dict("records"),
25-
editable=True,
26-
)
27-
],
17+
dbc.Col(
18+
html.Div(
19+
[
20+
dash_table.DataTable(
21+
id="table-editing-simple",
22+
columns=[
23+
{"name": i, "id": i} for i in ["time", "values"]
24+
],
25+
data=[
26+
{"time": 1, "values": 10},
27+
{"time": 2, "values": 20},
28+
{"time": 4, "values": 15},
29+
],
30+
editable=True,
31+
)
32+
]
33+
),
2834
style={"width": "150px"},
29-
className="six columns",
30-
),
31-
html.Div(
32-
[dcc.Graph(id="table-editing-simple-output")],
33-
className="six columns",
34-
style={"width": "800px"},
3535
),
36-
],
37-
className="row",
38-
)
39-
],
40-
style={"width": "800px"},
36+
dbc.Col(html.Div([dcc.Graph(id="table-editing-simple-output")])),
37+
]
38+
),
39+
]
4140
)
4241

4342

43+
app.layout = dbc.Container([row])
44+
45+
4446
@app.callback(
4547
Output("table-editing-simple-output", "figure"),
4648
[Input("table-editing-simple", "data"), Input("table-editing-simple", "columns")],

0 commit comments

Comments
 (0)