Hi @Marcas,
You can associate a slider to a go.Table
, such that at each step to get displayed only n columns from N, n<N.
import plotly.graph_objects as go
import pandas as pd
import plotly.io as pio
data = {}
for c in range(100):
name = 'col_'+str(c)
data[name] = [val+c for val in range(99)]
df = pd.DataFrame(data)
col_count = len(df.columns)
fig = go.Figure(data=[go.Table(
columnorder = [j for j in range(col_count)],
header=dict(values=df.columns,
fill_color='paleturquoise',
align='left'),
cells=dict(values=[df[c] for c in df.columns],
fill_color='lavender',
align='left'))
])
n=15 #number of columns to be displayed at a time
steps= [{'args': [{'columnorder': [[k+j for j in range(n) ]],
'header.values': [df.columns[k:k+n]],
'cells.values': [[df[col] for col in df.columns[k:k+n]]]
}],
'method': 'restyle'} for k in range((col_count-n+1))]
fig.update_layout(sliders=[dict(active = 0,
minorticklen = 0,
steps = steps)]);
To understand the slider step definition, see this notebook on the restyle method.