title: Chart.js - How to push a collection of array into dataset
body: <p>I have been trying many ways to push the collection of array into the dataset.
  Anyone can help me to push an array into stacked chart based on the codepen below?</p>
  
  <p>Here's the example</p>
  
  <p><a href="https://codepen.io/narendrajadhav/pen/abzpWam" rel="nofollow noreferrer">Codepen stacked bar</a></p>
  
  <p>Javascript</p>
  
  <pre><code>const getData = ()=&gt;new Array(7).fill('').map(v=&gt;randomScalingFactor());
  
  var barChartData = {
              labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
              datasets: [{
                  label: 'Dataset 1',
                  backgroundColor: window.chartColors.red,
                  data: getData()
              }, {
                  label: 'Dataset 2',
                  backgroundColor: window.chartColors.blue,
                  data: getData()
              }, {
                  label: 'Dataset 3',
                  backgroundColor: window.chartColors.green,
                  data: getData()
              }]
  
          };
          var ctx = document.getElementById('canvas').getContext('2d');
              window.myBar = new Chart(ctx, {
                  type: 'bar',
                  data: barChartData,
                  options: {
                      title: {
                          display: true,
                          text: 'Chart.js Bar Chart - Stacked'
                      },
                      tooltips: {
                          mode: 'index',
                          intersect: false
                      },
                      responsive: true,
                      scales: {
                          xAxes: [{
                              stacked: true,
                          }],
                          yAxes: [{
                              stacked: true
                          }]
                      }
                  }
              });
  
          document.getElementById('randomizeData').addEventListener('click', function() {
              barChartData.datasets.forEach(dataset=&gt;{
                  dataset.data = getData();
              });
              window.myBar.update();
          });
  </code></pre>
  
  <p>Here's the data for arrays</p>
  
  <p><a href="https://i.stack.imgur.com/H4lw3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H4lw3.png" alt="enter image description here"></a></p>
  
  <p>The issues should be the dataset with different colors and total should be the value for Y axis and there should be another collection of array date for X axis and the colors for the dataset should be different. The data for issues and total will be retrieved from Mysql database.</p>
  
  <p>I am using laravel and the table above was achieved using foreach loop.</p>