I have managed to create a gantt chart with dynamic sizes for the bars by updating the layout.
I would like to know however is there a way to autosize the chart itself I find that if there are a lot of points selected then they overlap each other rather than increasing the size.
any ideas how to handle this?
fig = ff.create_gantt(df_chart, colors=['#2CA02C', '#DC3912'], index_col='Details',
show_colorbar=True,
bar_width=0.1,
group_tasks=True,
showgrid_x=True,
showgrid_y=True,
title='Gantt')
#Disable range selector
x_axis_update = {'showgrid': True,
'zeroline': False,
'rangeselector': {},
'type': 'date'}
shapes = fig['layout']['shapes']
y0 = [d['y0'] for d in shapes]
new_y=[]
for x, y in zip(y0, y_width):
z = x + y
new_y.append(z)
#shapes dict containing custom width of bars
shapes_update = []
for i, p in zip(new_y, shapes):
p.update(y1 = i)
shapes_update.append(p)
fig['layout'].update(autosize=True, width=None, height=None, margin=dict(l=160, b=40, t=30), shapes=shapes_update, xaxis=x_axis_update)
graph = dcc.Graph(id='gantt chart', figure=fig)