I'm using a Gantt chart to show recording data from a large number of sensors in a distributed network over the course of a few years. (Some of the nodes in the network turn on or off intermittently, so this is an effective way to show the whole dataset at a glance.) I use plotly express to generate the Gantt chart from a list of filenames, so each Gantt bar corresponds to a .PNG file of a graph for a given day, and I can easily export the result as an interactive .html document.
I'd like to add a clickable link for each of the bars on the Gantt chart, so that clicking on a given bar will open the plot for the relevant day. This would make it much easier to explore the data. I can generate the links but am having trouble making it possible to open them from within the Gantt chart.
Here's my first pass at a MWE:
# WIP: Can I set up the Gantt chart so that clicking on an entry takes you to that graph?
import plotly.express as px
import pandas as pd
string1 = "<a href=https://www.nytimes.com/> link </a>"
df = pd.DataFrame([
dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Filename = string1),
dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Filename = string1),
dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30', Filename = string1)
])
fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", text="Filename") # textposition argument not possible
fig.update_traces(textposition='outside')
fig.show()
fig.write_html("test_gantt.html", include_plotlyjs="cdn")
The problems I'm running into with this are (a) for reasons I haven't been able to figure out, the link isn't clickable; (b) I can't click on the link in the alt text because it disappears as soon as I move my mouse; and (c) the bars on the Gantt chart I'm creating will be much smaller than these, so to be effective the link should really be associated with clicking on the bar itself.
Any tips are much appreciated.
Edit: Here is an example of what a finished Gantt chart looks like:
I would like to embed a link for each day's worth of data; as you can see, the bars are very small.


