Good afternoon,
I have a reference trace from which I compute a new one (I simply extract all points in between the reference trace’s one).
I need this new trace not to be displayed, but to serve as an anchor for annotations to be displayed over : this way, I can display permanent anchors located in the middle of all the reference track’s points.
Everything seems to be working, except for the annotations rendering. Here is how I do it:
// this trace contains the mid points I talked about earlier
const traceCartouche = [{
x: traceCartoucheX, // computed above
y: traceCartoucheY, // idem
type: 'scatter',
showlegend: false,
mode: 'text', // make the tooltip persistent
}]
// these are the actual annotation representation
const annotations = []
for (let i = 0; i < traceCartoucheX.length; i++) {
annotations.push({
x: traceCartoucheX[i],
y: traceCartoucheY[i],
xref: 'x',
yref: 'y',
// [...] styling...
})
}
Plotly.addTraces('myDiv', traceCartouche) // adding the ghost mid points trace
Plotly.relayout('myDiv', {}, annotations) // updates the graph layout with the annotations
Here are the annotations after creation:
However, they never show up. What did I do wrong ?