[Chartjs]-Display Chart.js chart in Node.js

5👍

One thing you could try is not initializing your chart until the document is for sure ready. You can do this using window.onload.

window.onload = function() {
  // put chart.js code here
}

Also, I notice that you are trying to link to a chart.js build located in your node_modules folder. I’m not exactly sure how to do this in express in an ejs file, but take a look at this answered question for an example on how to handle this.

You can always use the script hosted on a cdnjs to quickly validate your page is working. Here is an example.

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js">

Leave a comment