Black Lives Matter. Please consider donating to Black Girls Code today.

Add hover text to live streaming data

I have data that is coming in from an AJAX request, and I’m using extendTraces to plot the data on a plotly graph I have preinitialized with data. What I want to do is add hover text to the chart while it is plotting (the hover text is another data point I’m receiving from the ajax request). I’m not able to find any posts on how to go about with this. Please help!
Here’s a snippet of the code

let data = [{
x: [time],
y: [(ap).text()], mode: 'lines', line: {color: '#ed5940'}, name: 'A', text: (a).text()
x: [time],
y: [(bp).text()], mode: 'lines', line: {color: '#a0cc6c'}, name: 'B', text: (b).text()

Plotly.plot(graph, data);

setInterval( function() {

success: function(data){

let update = {
x: [[time], [time]],
y: [[data[‘ap’]], [data[‘bp’]]]

let olderTime = time.setMinutes(time.getMinutes() - 1);
let futureTime = time.setMinutes(time.getMinutes() + 1);

let view = {
xaxis: {
type: ‘date’,
range: [olderTime,futureTime],

Plotly.relayout(graph, view);
Plotly.extendTraces(graph, update, [0, 1])
)}, 200);

I want to add value of variable “a” to the plot of “ap” and “b” to the plot of “bp”. Any help would be appreciated!

You could try to programmatically fire mouse events to display hover labels.