for (var i = 0; i < = limit – 2; i + +) was feeding the x axis nulls.
You were getting a null value because there is an additional N in the end. You can either remove that N in the end and use limit – 1 or you can use limit – 2 as you are doing now.
You are not able to zoom/pan because there are only 5 dataPoints in the chart. CanvasJS stops zooming when there are only a few dataPoints in the view port and are clearly visible. If you add another 5-10 dataPoints atleast, you’ll be able to zoom/pan.