I am trying to use the function given on the plotly website but use a javascript array instead of manually entering values. The array would have different length based on the run. Can anyone help comment on a way of doing that? Tried substituting the matrix for x/y axes below and it does not generate the plot.
var trace2 = {
x: [2, 3, 4, 5],
y: [16, 5, 11, 9],
mode: ‘lines’
};
var trace3 = {
x: [1, 2, 3, 4],
y: [12, 9, 15, 12],
mode: ‘lines+markers’
};
var data = [ trace1, trace2, trace3 ];
var layout = {
title:‘Line and Scatter Plot’
};
Plotly.newPlot(‘myDiv’, data, layout);