title: Adding legend to Google chart
body: <p>I am trying to add the column headings to the legend in this line graph, they should be the first row within the data table. The graph works fine if I remove the headings, however when I try load it with the headings I am getting nothing. Below is the output of the code that creates the input table it looks correct based on the google api example. Thanks</p>
  
  <p><code>['Date','Species A', 'Species B'],['2013-08-27',3,1], ['2013-09-17',4,1], ['2013-08-23',1,1], ['2013-08-10',2,8]</code></p>
  
  <p><strong>The relevant bits of code</strong></p>
  
  <pre><code> $result = mysqli_query($con,"SELECT * FROM Species");
   while($row1 = mysqli_fetch_array($result))
   {
    $data1[]=    "['" . $row1['Date'] . "'," . $row1['SpeciesA'] . "," . $row1['SpeciesB'] . "]";
   }
  
          $headings = "['Date','Species A', 'Species B'],";
          $headingdata = $headings . implode(",\n",$data1);
          echo $headingdata;
  ?&gt; 
  
    &lt;html&gt;
    &lt;head&gt;
    &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);
    function drawChart()
     {
            // Create the data table.
                var data = new google.visualization.DataTable();
                data.addColumn('string', 'Date');
                data.addColumn('number', 'Species A');
                data.addColumn('number', 'Species B');
                data.addRows([
  
                &lt;?php echo $headingdata;?&gt;
                ]);
  </code></pre>