Chartjs-How to render data using chartjs in expressJS

0👍

You almost got that right. You can declare the data fetched from the DB as a JSON object and pass it to your Chart. Like so,

 var myLineChart = new Chart(ctx, {
    type: 'line',
    data: {
      labels: labelsObject,
      datasets: dataObject
    },
    options: chart_ops
  });

Leave a comment