How to grab and plot data from a PostgreSQL database via Chartjs

👍:0

instead of printing, assign to variables

something like:
var xValues = res.rows.map((val) => val.year);

(written from my head, I didn’t test it)

You can also read about getting asynchronous data.
There are many examples.

you may want to check documentation first
https://github.com/chartjs/Chart.js

Leave a comment