title: Draw a Google Chart with undefined number of lines
body: <p>I need to draw a Google Chart with an undefined number of lines (rows). Lets suppose I need to draw the number of goals of two teams in a certain day (the number of teams is fixed for the example, but it could be anyone, the number of days are the same for all teams). I have this array:</p>
  
  <pre><code>Array
  (
      [team1] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [day] =&gt; 1
                      [goals] =&gt; 3
                  )
  
              [1] =&gt; Array
                  (
                      [day] =&gt; 2
                      [goals] =&gt; 1
                  )
  
              [2] =&gt; Array
                  (
                      [day] =&gt; 3
                      [goals] =&gt; 0
                  )
          )
      [team2] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [day] =&gt; 1
                      [goals] =&gt; 1
                  )
  
              [1] =&gt; Array
                  (
                      [day] =&gt; 2
                      [goals] =&gt; 2
                  )
  
              [2] =&gt; Array
                  (
                      [day] =&gt; 3
                      [goals] =&gt; 4
                  )
          )
  )
  </code></pre>
  
  <p>I have tried creating this loop:</p>
  
  <pre><code>    $resultArray = array();
      $resultArray['cols'][] = array('label' =&gt; "Day", 'type' =&gt; 'string');
      // $array is the one shown before
      foreach($array as $key =&gt; $chartData){
          $resultArray['cols'][] = array('label' =&gt; $key, 'type' =&gt; 'number');
          foreach($chartData as $data){
              $resultArray['rows'][] = array('c' =&gt; array( array('v' =&gt; $data['day']), array('v' =&gt; $data['goals'])));
         }
     }
  </code></pre>
  
  <p>The problem is that the chart only draws one line with the data from both teams joined all together instead two lines one for each team. </p>
  
  <p>I would really appreciate any help.</p>