title: chartjs & asp.net: Cannot read property 'labels' of undefined
body: <p>I have been through all the posts regarding this issue yet I can not fix it.  </p>
  
  <p>My chartjs line chart gets created fine.  I am trying to test updating it (adding data) but i'm stuck on the chart.data.labels.push(labels) as it states the object is undefined in the console.  Yet on the console, the line before, I write the id of the object and it is correct so it has the ref.</p>
  
  <p>Any thoughts?</p>
  
  <p><strong>Chart is created fine</strong></p>
  
  <pre><code>$(function () {
      LoadChart();
  });
  
  function LoadChart() {
      var ctx = document.getElementById('myChart');
      var myChart = new Chart(ctx, {
          type: 'line',
          data: {
              labels: ['9:30', '9:31', '9:32', '9:33', '9:34', '9:35'],
              datasets: [{
                  label: 'RSI',
                  data: [12, 19, 3, 5, 2, 3],
                  borderWidth: 1
              }]
          },
          options: {
             title: {
                  display: true,
                  text: 'Custom Chart Title'
              }
          }
      });
  }
  </code></pre>
  
  <p><strong>Error When trying to update the chart</strong></p>
  
  <pre><code>$.connection.redisHub.client.addData = function (chartID, labels, data) {
      var chart = document.getElementById(chartID);
      console.log("chart: " + chart.id);
      chart.data.labels.push(labels);
      chart.data.datasets.forEach((dataset) =&gt; {
          dataset.data.push(data);
      });
      chart.update();
  }
  </code></pre>
  
  <p><strong>Console Output</strong>
  You can see it correctly writes 'chart: myChart' to the console showing we have the object ref. correct.
  <a href="https://i.stack.imgur.com/vwtcI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vwtcI.png" alt="enter image description here"></a></p>
  
  <p><strong>asp code calling the js function (all works well here)</strong></p>
  
  <pre><code>string[] labels = { "9:36", "9:37" };
  int[] data = { 9, 10 };
  Clients.All.addData("myChart", labels, data); 
  </code></pre>
  
  <p><strong>html : all is well here</strong></p>
  
  <pre><code>&lt;div class="col-sm-8"&gt;
      &lt;canvas id="myChart" width="400" height="200"&gt;&lt;/canvas&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thank you in advance</p>