title: Hide or remove column in Google Chart if rows are empty
body: <p>In google chart (table is the chart type) how do I determine if rows in a column is empty and then hide that column?
  <br>for example:</p>
  
  <p><code>[Boys] [Girls]
   [ 1  ] [    ]
   [ 3  ] [    ]
   [ 3  ] [    ]</code></p>
  
  <p><em>Girls</em> column is empty therefore hide or remove it, resulting in the table chart showing only the <em>Boys</em> column.</p>
  
  <p><code>[Boys]
   [ 1  ]
   [ 3  ]
   [ 3  ]</code></p>
  
  <p><strong>Here is a sample of my code:</strong></p>
  
  <pre><code>var datatable = new google.visualization.DataTable();
  
  var rows = [
    {
      "Year": 2014,
      "Period": 3,
      "Segment": "*",
      "AnswerOption": 0,
      "AnswerValue": 5,
      "ResultCount": 2,
      "ResultAverage": 33.3333
    },
    {
      "Year": 2014,
      "Period": 4,
      "Segment": "*",
      "AnswerOption": 0,
      "AnswerValue": 5,
      "ResultCount": 5,
      "ResultAverage": 100.00
    }
  ]
  
  datatable.addColumn('string', 'Year');
  datatable.addColumn('number', 'Period');
  datatable.addColumn('string', 'Segment');
  datatable.addColumn('string', 'AnswerOption');
  datatable.addColumn('number', 'AnswerValue');
  datatable.addColumn('number', 'ResultCount');
  datatable.addColumn('number', 'ResultAverage');
  
  
  for(var j=0; j &lt; rows.length; j++) {
  datatable.addRows([
      [
          String(rows[j].Year),
          rows[j].Period,
          rows[j].Segment,
          rows[j].AnswerOption,
          rows[j].AnswerValue,
          rows[j].ResultCount,
          rows[j].ResultAverage,
      ]
   ]);    
  }
  </code></pre>
  
  <p>In this example, all <code>AnswerOption</code> is <code>0</code> therefore google chart displays an empty cell.</p>