Sunday 21 May 2017

Chart doesn't load since promise implementation

I use node on the server and chart.js on client, chart's values doesn't get displayed since I implemented the following promise:

app.get("/",function(req,res){
     createQueryFile().then((res)=>{
        return findIR(); 
    },(err)=>{
        console.log(err)
    }).then(()=>{
                res.render('welcome', {
                ok:ok ,Number:Number, Time:Time, Text:Text
                });    
                console.log("in route");  
    },(err)=>{
        console.log(err);
    });
});

The webpage loads but chart's values are not there. This promise results in 2000ms delay. I assume the graph data is not there bacause of the delay. Not sure how to force the client to wait for the data from server . Thx.



via plska

No comments:

Post a Comment