I’m trying to extend my second trace with
Plotly.extendTraces(‘chart’, { x: [[xVal]], y: [[YVal]] }, [1]); // second trace
Although it turns out I cant pass x parameter (only y).
How does extendTraces guess x value?
Is there any way I can specify x value too?
That shouldn’t be. Would you mind sharing a reproducible example to help us debug?
Okay, I got the same problem. This doesn’t work:
let value_x = [pointValue[1]];
let value_y = [pointValue[2]];
console.log(pointValue[1], pointValue[2]);
Plotly.extendTraces('graphDiv', {
x: [[value_x]],
y: [[value_y]]
} , [7]);
But if I hard code the values like this it works:
let value_x = [pointValue[1]];
let value_y = [pointValue[2]];
console.log(pointValue[1], pointValue[2]);
Plotly.extendTraces('graphDiv', {
x: [[20]],
y: [[20]]
} , [7]);
I also tried to use parseFloat
on those values just to make sure they were the correct type but that didn’t change anything.
this was wrong… i made it a sub -sub array.
let value_x = pointValue[1];
let value_y = pointValue[2];
and it’s working!