|
1 | 1 | import dash
|
| 2 | +import dash_bootstrap_components as dbc |
2 | 3 | import dash_core_components as dcc
|
3 | 4 | import dash_html_components as html
|
4 | 5 | import dash_table
|
5 | 6 | import pandas as pd
|
6 | 7 | from dash.dependencies import Input, Output
|
7 | 8 |
|
| 9 | +app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) |
8 | 10 |
|
9 |
| -app = dash.Dash(__name__) |
10 |
| -app.css.append_css({"external_url": "https://codepen.io/chriddyp/pen/bWLwgP.css"}) |
11 | 11 |
|
12 |
| - |
13 |
| -df = pd.DataFrame({"time": [1, 2, 4], "values": [10, 20, 15]}) |
14 |
| - |
15 |
| -app.layout = html.Div( |
| 12 | +row = html.Div( |
16 | 13 | [
|
17 |
| - html.Div( |
| 14 | + dbc.Row(dbc.Col(html.Div("Waveform editor"))), |
| 15 | + dbc.Row( |
18 | 16 | [
|
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 | + ), |
28 | 34 | 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"}, |
35 | 35 | ),
|
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 | + ] |
41 | 40 | )
|
42 | 41 |
|
43 | 42 |
|
| 43 | +app.layout = dbc.Container([row]) |
| 44 | + |
| 45 | + |
44 | 46 | @app.callback(
|
45 | 47 | Output("table-editing-simple-output", "figure"),
|
46 | 48 | [Input("table-editing-simple", "data"), Input("table-editing-simple", "columns")],
|
|
0 commit comments