I have an gantt chart and there are some vertical line. I want to disable and enable thats by buttons.
When I click none button, the v_lines should be disable and when I click All button, they should be enable.
My code is:
fig=px.timeline(x_start=start,x_end=endTime,y=taskAndDuration,color=taskFilterNamesList)
taskCount=0
while taskCount < len(fileNames):
fig.add_trace(go.Scatter(x=[allFirstStartTime[taskCount]], y=taskAndDuration,
mode='lines+markers',
fillcolor='black',
name=fileNames[taskCount]))
fig.add_vline(x=allFirstStartTime[taskCount], line_width=2,line_color='black',y0=0,visible=True)
taskCount += 1
fig.update_yaxes(autorange='reversed', title='Tasks')
fig.update_xaxes(title='Time')
fig.update_layout(
xaxis=dict(showgrid=False),
yaxis=dict(showgrid=False),
#disable and ebable buttons for filter tasks
updatemenus=[
dict(
type="buttons",
direction="right",
active=0,
x=1,
y=1,
buttons=list([
dict(label="All",
method="update",
args=[{"visible":[True]},
{'xaxis2.visible': True}]),
dict(label="None",
method="update",
args=[{"visible":['legendonly']},
{'xaxis2.visible': False}],
),
]),
)
],