I have created a Gantt chart for some log analysis. I want a feature in it such that when we hover over a plot, the plot should highlight itself to show which plot I am highlighting.
def create_gantt_data(df):
tasks = {}
gantt_data = []
for _, row in df.iterrows():
task = row['FileType']
start = row['timestamp'].to_pydatetime() # Convert to Python datetime object
end = row['Endtime'].to_pydatetime() # Convert to Python datetime object
method = row['Method'] # Get the Method column
if task not in tasks:
tasks[task] = []
# Check for overlap
overlap = False
for t in tasks[task]:
if (start < t['end'] and end > t['start']):
overlap = True
break
if overlap:
# Create a new line for overlapping task
task += " (Overlap)"
if task not in tasks:
tasks[task] = []
tasks[task].append({'start': start, 'end': end})
gantt_data.append(dict(
Task=task,
Start=start,
Finish=end,
Method=method,
HoverText=f"Start: {start}<br>End: {end}<br>Method: {method}"
))
return gantt_data
gantt_data = create_gantt_data(df1)
# Create the Gantt chart
fig = ff.create_gantt(gantt_data, index_col='Task', show_colorbar=True, group_tasks=True)
I tried to use figure Widget function,but was unable to react the desired goal.
enter image description here
New contributor
Pratyush Nagpal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.