title: Fill missing array elements with zero values for Flot
body: <p>I'm creating an array in PHP to send back to the front end for display in a Flot line chart.  I have data that should be displayed year to date by month.  If my SQL statement doesn't find any values for a given month, there is no array element for that month, and the Flot chart doesn't plot a data point for that month (See Mar and Apr in screenshot below). I'd like it to show a zero data point for months where there is no data.</p>
  
  <p>Here's how I'm creating my array:</p>
  
  <pre><code>        $array = array();
          $array['data'] = Array();
          $array['label'] = $tags[0]['tag_name'];
  
          foreach($tags as $key=&gt;$value) {                
              $month = $value['month'];
              $arr = Array($month, $value['trans_amount']);
              array_push($array['data'], $arr);
          }
  </code></pre>
  
  <p><strong>Current output:</strong>  </p>
  
  <pre><code>{"data":[[1,"75.00"],[2,"170.00"],[5,"100.00"]],"label":"example label"}
  </code></pre>
  
  <p><strong>Desired output:</strong></p>
  
  <pre><code>{"data":[[1,"75.00"],[2,"170.00"],[3, "0"],[4, "0"],[5,"100.00"]],"label":"example label"}
  </code></pre>
  
  <p>and here's how the chart currently displays with the current output:</p>
  
  <p><img src="https://i.stack.imgur.com/rml4I.png" alt="enter image description here"></p>