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

#14956

Suyash Singh
Moderator

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.

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

This will resolve your issue.

___
Suyash Singh
Team CanvasJS