I am trying to add hoverinfo to the bars on my gantt chart. I followed other tutorials to update the hoverinfo after the figure is made, but I have ran into a problem where len(fig[“data”]) is not equal to len(df). In my case len(df) ~ 1000 but len(fig[“data”] ) == 20. This is further confusing because there are 34 groups of tasks.
I would like to have an entry in fig[“data”] for every element in the df I am using to build the gant chart. This way I can update the hoverinfo for each bar.
Background information may help: I am trying to make a gantt chart for plotting maneuvers on a constellation of spacecraft and would like to have the hoverinfo on each bar be the details of the given maneuver
A snippet of what I am using is
df = []
for name, start, end, duration, direction, Type, dV, purpose, no, _id in data:
df.append(dict(Task=name, Start=start, Finish=end))
fig = ff.create_gantt(df=df, group_tasks=True)
for i in range(len(fig["data"])):
name, start, end, duration, direction, Type, dV, purpose, no, _id = data[i]
text = "start: {}<br>end: {}<br>duration (s): {}<br>thrust direction: {}<br>type: {}<br>purpose: {}<br>dV (m/s): {}<br>burn no: {}".format(start, end, duration, direction, Type, purpose, dV, no)
fig["data"][i].update(text=text, hoverinfo="text")