How to display 'variable' text in a hover template

Currently, for a trace, I have a hover template defined as follows:

hovertemplate : 'Az: %{x}, El: %{y},
',

and this displays just fine and just as I want to.

But I want to extend it to display the time such as:

var time = ‘1:23pm’;
hovertemplate : ‘Az: %{x}, El: %{y},
, %{time}’

So that now, the hover text will display the time I tell it to. Is this possible in plotly.js ?

Thank You!!

2 Likes

Here’s one way (using customdata): https://codepen.io/etpinard/pen/zXLEXJ?editors=0010

2 Likes