Chartjs-Not able to show data on Chart.js

1👍

If you are going to pass the data in as one big object, you need to nest “data” one more time inside it, like this:

 var data = {
   type:'line',
   data: {      // add this here, and its closing brace of course
       labels :  ["02:00","04:00","06:00","08:00","10:00","12:00","14:00","16:00","18:00","20:00","22:00","00:00"],
       datasets: [
       {
           fillColor : gradient, // Put the gradient here as a fill color
           strokeColor : "#ff6c23",
           pointColor : "#fff",
           pointStrokeColor : "#ff6c23",
           pointHighlightFill: "#fff",
           pointHighlightStroke: "#ff6c23",
           data : [25.0,32.4,22.2,39.4,34.2,22.0,23.2,24.1,20.0,18.4,19.1,17.4]
      }]
   },
   options: options  
 };

Leave a comment