Hi all,
I am trying to update tables in plotly using a dropdown update_menu. I can update all attributes of the table however I come unstuck when trying to set the fill_color or line_color properties. Whenever I select from the dropdown attempting to set these properties, all I receive is the default color scheme. Here is my code below along with an image of the resulting table.
import plotly.graph_objects as go
from plotly.offline import plot
fig = go.Figure()
fig.add_trace(
go.Table(
header=dict(
values=['<b>Name</b>','<b>Age</b>','<b>Gender</b>'],
font=dict(size=12, family='Arial', color='rgb(0,0,0)'),
line_color='rgb(0,0,0)',
fill_color='rgb(255,255,255)',
align="center"
),
cells=dict(
values=[['Pete', 'Julie'], [20, 19], ['Male', 'Female']],
align="center",
format=[[None, None], ['.0f', '.0f'], [None, None]],
font=dict(size=11, family='Arial', color='rgb(0,0,0)'),
fill_color='rgb(255,255,255)',
line_color='rgb(0,0,0)')
)
)
fig.update_layout(
updatemenus=[
go.layout.Updatemenu(
active=0,
buttons=[
dict(args=[{'header': dict(values=['<b>Name</b>','<b>Age</b>','<b>Gender</b>'],
font=dict(size=12, family='Arial', color='rgb(0,0,0)'),
line_color='rgb(0,0,0)',
fill_color='rgb(255,0,0)',
align="center")}],
label='Header Red', method='restyle'),
dict(args=[{'header': dict(values=['<b>Name</b>','<b>Age</b>','<b>Gender</b>'],
font=dict(size=12, family='Arial', color='rgb(0,0,0)'),
line_color='rgb(0,0,0)',
fill_color='rgb(0,0,255)',
align="center")}],
label='Header Blue', method='restyle')
],
direction="down", pad={"r": 10, "t": 10}, showactive=True,
x=0.1, xanchor="left", y=1.05, yanchor="top")])
plot(fig, include_plotlyjs=True, filename=r'C:\Colouring_Issue.html')