Iād like to add data from other columns (āProductionOrderā, āFInishDateā) into the hover label of my scatter plot.
import plotly.graph_objs as go
def PlotYield(df, title=''):
#s = df['PercentYield'].std()
#x = df['PercentYield'].mean()
#y_max = df['PercentYield'].max()
#y_min = df['PercentYield'].min()
#if y_max < 100:
# y_max = 100
#if y_min > 0:
# y_min = 0
plot = go.Figure(
data=[go.Scatter(
x = df.index,
y = df['PercentYield'],
mode = 'lines+markers',
line = {'color':'black'},
customdata = [df['ProductionOrder'], df['FinishDate']],
hovertemplate = '<br>'.join(['PercentYield: %{y:.1f}%',
'PRO: %{customdata[0]}',
'FinishDate: %{customdata[1]}'])
)],
layout={'template':'ygridoff+xgridoff',
'title':title})
#SPC(plot, mean=x, stdev=s,
# y_max=y_max, y_min=y_min)
return plot
Unfortunately, the resulting label from the hovertemplate simply returns the string: '{%customdata[i]}'
From a similar question on this forum, I found that using 'fullData.customdata[i]'
works to return the entire df[column] list, but I canāt seem to find a way to just return the relevant point.
Has anyone run into a similar issue or have a solution?