Show Table As Fig In Dash And Add Scrollbar
i create tables with plotly and i show them in plotly dash. i would like to add an scroll-bar. is this possible? thanks for help #generate fig import plotly.graph_objects as go
Solution 1:
why are you showing the table as a graph object in dash you can create a table object using the following logic from dataframe
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table
import pandas as pd
df = pd.DataFrame([[100, 90, 80, 90], [95, 85, 75, 95]]).T
df.columns = ['A Scores', 'B Scores']
app = dash.Dash()
app.layout = html.Div([
dash_table.DataTable(
id='table_id',
columns = [{"name": i, "id": i} for i in df.columns],
data = df.to_dict("rows"),
row_selectable="single",
fixed_rows={'headers': True, 'data': 0},
fixed_columns={'headers': True, 'data': 0},
)
])
app.run_server(debug=True, use_reloader=False)
then if needed scrollbar will be added automatically (or you can change the size of the table see https://dash.plotly.com/datatable for more info
to add scrollbar to graph object use the following
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Graph(figure=fig,style={'overflowY': 'scroll', 'maxHeight': '200px'} )
])
app.run_server(debug=True, use_reloader=False)
Post a Comment for "Show Table As Fig In Dash And Add Scrollbar"