Chartjs-Problems trying to render some data on chartjs

0👍

I think you are accessing your data using the wrong expression. To access JSON data in your script in EJS template do this

var myData = JSON.parse('<%- JSON.stringify(dataFromServer) %>'); //use <%- not <%=
console.log(myData)    //try logging to check if you are actually getting any data

now you can access your data for charts.

EDIT

In case you already have strigified data, parse it into JSON before using it

var myData = JSON.parse('<%- dataFromServer %>');

Leave a comment