Hi all
Is it possible to add customer hover for gantt plot?
like this:
dict(Task='Evening Sleep', Start=start, Finish=end, Resource='Sleep', Text = 'my hover1' )
so when my mouse hover this gantt block, the hover information is what I put in Text
import plotly
import plotly.figure_factory as ff
df = [
dict(Task='Evening Sleep', Start=start, Finish=end, Resource='Sleep', Text = 'my hover1' ),
dict(Task='Morning Sleep', Start=start Finish=end, Resource='Sleep',Text = 'my hover1')
]
colors = dict(Cardio = 'rgb(46, 137, 205)',
Food = 'rgb(114, 44, 121)',
Sleep = 'rgb(198, 47, 105)')
fig = ff.create_gantt(df, colors=colors, index_col='Resource', title='Daily Schedule',
show_colorbar=True, bar_width=0.8, showgrid_x=True, showgrid_y=True, group_tasks=True)
plotly.offline.plot(fig, filename='gantt-hours-minutes.html')
Thanks
I believe the 'Description' field will do the tricks.
Check the PR https://github.com/plotly/plotly.py/pull/588
Yes, the Description field adds hover information to the tooltip.
import plotly
import plotly.figure_factory as ff
df = [
dict(Task='Evening Sleep', Start='2009-01-01', Finish='2009-02-28', Resource='Sleep', Description = 'my hover1' ),
dict(Task='Morning Sleep', Start='2009-03-05', Finish='2009-04-15', Resource='Sleep', Description = 'my hover1')
]
colors = dict(Cardio = 'rgb(46, 137, 205)',
Food = 'rgb(114, 44, 121)',
Sleep = 'rgb(198, 47, 105)')
fig = ff.create_gantt(df, colors=colors, index_col='Resource', title='Daily Schedule',
show_colorbar=True, showgrid_x=True, showgrid_y=True, group_tasks=True)
Hope that helps!
Most helpful comment
Yes, the
Descriptionfield adds hover information to the tooltip.Hope that helps!