I'm trying to add a Plotly chart to my webpage. The data is being sent to Javascript through SocketIO, but the chart is empty.
I don't understand why, since the data is being pushed to arr. Any advice?
var arr = [];
socket.on('two', function(msg) {
    arr.push(msg.num)
    console.log(arr)
  });
  Plotly.plot('chart',[{
      y:[0],
      type:'line'
    }]);
    var cnt = 0;
    setInterval(function(){
        Plotly.extendTraces('chart',{ y:[[arr]]}, [0]);
        cnt++;
        if(cnt > 500) {
            Plotly.relayout('chart',{
                xaxis: {
                    range: [cnt-500,cnt]
                }
            });
        }
    },15);
 
     
    