Dash Graph - modify hovering data

Hi all,
Still new to Dash and enjoying the learning.
A bit of struggle with modifying the hovering data.
Here is the Issue:


The only thing I want to modify is the titles while the hovered data is displayed:
instead of variable–>camera num, x–>timeStamp etc…
The DataFrames I’m using to generate the graphs have no titles.
Any workaround generating a completely new dictionary? I saw the tooltips, but it’s good only for tables?
Thank you for your time!
Simon

Is there any reason that prevents you from renaming the DataFrame columns? If not, simply assign the names you want to find to the DataFrame colums.
See here for info on how to rename the columns of a pandas DataFrame.

If this doesn’t help, please share the code you use to generate your graph.

Thanks MichelH!
The DF that is plugged into the dcc.Graph as a figure does have the right col names (I generate a dictionary with all the final Figures before the Dash app is running), so I’m guessing I’m missing here something -


In this example, I’m trying to display a combined graph of a few data containers.
Expected: The dash engine will recognize the col name as the variable
Current: The hovering data is displaying default values. The legend to the right (C01, C02, C03) is customized manually in a different function (Before that it was also displaying wide_variable_0, wi…)
My apologies for the ones that see the camelHamps on a python code as abuse, I’m just following some requests:

df = pd.concat(lstOfDFToConcat, axis=1)
fig = px.line(df, x=list(df.index)[0:],
            y=[df.iloc[:, i] for i in range(len(df.columns))])


This fig is returned to a dcc.Graph in a later callback that generates the graphs from the first screenShot I uploaded.
Thanks for the effort.
Simon

Hi Simon, thanks for the additional details. However, I still have trouble reproducing your steps.

Could you post a minimal working example that I could run myself? You don’t need to include your whole data set, just 3 or 4 randomly chosen data points to get the idea across.

In any case, I believe the example in the section “Customizing hover text with a hovertemplate” might be helpful to you:

Thanks MichelH!
Solved by removing the explicit inputs -

# fig = px.line(df, x=list(df.index)[0:],
     #               y=[df.iloc[:, i] for i in range(len(df.columns))])

Turned into:

fig = px.line(df)

Thanks Again!
Simon