himanbaby2007
It is tough to guess the issue without knowing your data format. Can you provide your sample data? For now I can suggest you to
1) In line 5 instead of k+ use k++
2) Move your document.addEventListener( 'DOMContentLoaded', function (){..code..}
in place of updateChart(dataLength).
3) Check the url in EventSource.