Plotly's docs show a hovertemplate that provides access the x & y values in the text, but how can we access data in the other columns?
Imports:
import pandas as pd
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot
Code:
test_data = {"client1-percent":[90,100,60]
, "client1-volume":[500000,3542,20000]
, "client2-percent":[99,63,98]
,"client2-volume":[6423,6524,5737]
}
df = pd.DataFrame(test_data)
data = [go.Scatter(
x = df.index.values
, y = df.loc[:,col].values
, hovertemplate = "Percent: %{y:.1f}% | Volume: {}"
, mode = 'lines+markers'
, name = col.replace("-percent","")
) for col in df.columns if "-volume" not in col]
plot(data, filename='test.html')
So the specific question here is this: how can client volume be added to the text in this plotly tooltip?