Hi, I’m new in Javascript and Plotly. I’m have no idea how to solve the error message [TypeError: Cannot read property ‘map’ of undefined]. I’m plotting a scatter plot with 2 sets of input data. I try to update the data setting and the error message is prompt for the last line of the code as shown below:
trace1 = {
x: xdata,
y: ydata,
mode: ‘markers’,
type: ‘scatter’,
text: cdata,
marker: {size: 20}
}
if (!isNaN(cdata[1])){
var update = {
marker: {color: cdata}
};
Plotly.restyle(‘view’, update);
}
else {
var update = {
transforms: [{type: “groupby”, groups: cdata}]
};
Plotly.restyle(‘view’, update);
}
Any help would be greatly appreciated.