Plotly.py: Request adding customer hover for gantt plot

Created on 11 Jan 2018  路  2Comments  路  Source: plotly/plotly.py

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

Most helpful comment

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!

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EmilienDupont picture EmilienDupont  路  4Comments

ivirshup picture ivirshup  路  3Comments

suciokhan picture suciokhan  路  3Comments

entron picture entron  路  4Comments

dhirschfeld picture dhirschfeld  路  4Comments