title: Undefined values in chart.js from json
body: <p>i am working on showing data in a bar chart with <code>chart.js</code> . my json response is already ready there but chart says its undefined values.</p>
  
  <p><strong>here is jquery with json</strong> </p>
  
  <pre><code>    $(document).ready(function(){
      $.ajax({
          url: "&lt;?php base_url();?&gt;/charts/getsome",
          method: "GET",
          success: function(data) {
              console.log(data);
              var month = [];
              var customers = [];
  
              for(var i in data) {
                  month.push("Customer in" + data[i].apply_month);
                  customers.push(data[i].no_customers);
              }
              var chartdata = {
                  labels: month,
                  datasets : [
                      {
                          label: 'monthly customers',
                          backgroundColor: 'rgba(200, 200, 200, 0.75)',
                          borderColor: 'rgba(200, 200, 200, 0.75)',
                          hoverBackgroundColor: 'rgba(200, 200, 200, 1)',
                          hoverBorderColor: 'rgba(200, 200, 200, 1)',
                          data: customers
                      }
                  ]
              };
  
              // alert(chartdata);
  
              var ctx = $("#mycanvas");
  
              var barGraph = new Chart(ctx, {
                  type: 'bar',
                  data: chartdata
              });
          },
          error: function(data) {
              console.log(data);
          }
      });
  });
  </code></pre>
  
  <p><strong>below is a snap for json response in console</strong></p>
  
  <p><a href="https://i.stack.imgur.com/klvbd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/klvbd.png" alt="enter image description here"></a></p>
  
  <p><strong>And here is also a snap for chart with error</strong></p>
  
  <p><a href="https://i.stack.imgur.com/NX69C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NX69C.png" alt="enter image description here"></a></p>
  
  <p>Please guide me where i am wrong. Thanks</p>