Advanse use of `hovertemplate`

Ok, so I have just started with PlotyJS and need help with something I am stuck with:

I am working with hovertemplate and need it to display the following formate:

Country: COUNTRY_NAME,


Total Deaths: X_AXIS,
Total Cases: Y_AXIS,
Active Cases: PLOT_SIZE*4000,

Now the problem is clear, first, where do I define COUNTRY_NAME if I can’t define it in one of the parameters of the go.Scatter, second, how do I numerically work with the Active Cases in which I have to multiply the plot size with 4000(as I used it as my prefered value for showing all the plots)

one solution may be to use costomdata but I can’t get it to work for more than one use case(Active Cases), as if I use something like %{customdata[0]} where my list is something like:

customdata = [
[Active Cases ,data],
[Country, data]
]

Does anyone know a way around?

Thanks,
Dex Devlon

Hi @bin0x00,

Welcome to Plotly forum!
From your post I cannot deduce if you are a plotly.js or a plotly.py user, because you selected plotly.py category.

This tutorial on how to define a customdata array is for Python users: https://plotly.com/~empet/15366/customdata-for-a-few-plotly-chart-types/#/

Hope it helps understand customdata definition even if you are working with plotly.js.

Ok, I found the solution, thanks to @empet.

For people struggling with the same problem, here’s the solution:

You will have to merge the two data into a list rather than having two different lists e.g.

customdata = [
[Active Cases Data, Country Data],
]

Thanks,
Dex Devlon