Hi,
I am using Plotly in a real-time streaming scenario and I need to display a scatter plot with statistical error bars. This is my trace object:
var trace = {
type: ‘scatter’,
mode: ‘markers’,
hoverinfo: ‘text’,
text: [],
x: [],
y: [],
marker: {
size:8,
symbol: [‘circle’]
},
error_x: {
array: [],
arrayminus: [],
symmetric: false,
type: ‘data’,
visible: true,
width: 0,
thickness : 1
},
error_y: {
array: [],
arrayminus: [],
symmetric: false,
type: ‘data’,
visible: true,
width: 0,
thickness : 1
},
};
Currently I am using the react() function in order to redraw the points each time new data arrive, but the performance decreases linearly as the number of points increases (with 300 points I have 0,4 s delay).
The extendTraces() function is what I should use to increment the performance, but apparently I can extend only the “x”, “y” and “text” (“trace-root-level”) arrays but not the “array” and “arrayminus” arrays that are located inside the error_x object.
This function call works,
Plotly.extendTraces(p, {text: [[ newText ]], y: [[ newY ]], x: [[ newX ]]}, [0])
I try to call the extendTraces() function with this other signature but it doesnt work:
Plotly.extendTraces(p, {text: [[ newText ]], y: [[ newY ]], x: [[ newX ]], error_x: { array: [[ newXError ]] } }, [0])
plotly.min.js:7 Uncaught Error: attribute error_x must be an array of length equal to indices array length
Thank you in advance.