Home forums Using CanvasJS How can I plot values from .txt file ? Reply To: How can I plot values from .txt file ?


Suyash Singh

Hi @kingbib,

processData(allText) requires an argument. Since you are not passing any argument to it, setInterval(function(){ processData(); }, 1000); an error is thrown when you try to split the variable allText since it is undefined.

Instead of calling the processData() only, you can put the entire ajax call in setInterval.

        type: "GET",
        url: "dataSmall.txt",
        dataType: "text",
        success: function (data) { processData(data); }	
 }, 1000);

This will resolve your issue.

Suyash Singh
Team CanvasJS