title: Google Charts BarChart OnClick or OnSelect
body: <p>The code creates Google Charts Bar chart with 2 columns.</p>
  
  <pre><code>&lt;?php
  $sth = mysql_query("select * from table");
  $rows = array();
  //flag is not needed
  $flag = true;
  $table = array();
  $table['cols'] = array(
                  array('label' =&gt; 'Stats', 'type' =&gt; 'string'),
                  array('label' =&gt; 'Value', 'type' =&gt; 'number')
                  );
  $rows = array();
  while($r = mysql_fetch_assoc($sth)) 
  {
  $temp = array();
  $temp[] = array('v' =&gt; (string) $r['Stats']); 
  $temp[] = array('v' =&gt; (int) $r['Value']); 
  $rows[] = array('c' =&gt; $temp);
  }
  $table['rows'] = $rows;
  $jsonTable = json_encode($table);
  ?&gt;  
  &lt;script type="text/javascript"&gt;
  google.load('visualization', '1', {'packages':['corechart']});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
    var data = new google.visualization.DataTable(&lt;?php echo $jsonTable; ?&gt;);
    var options = {
          legend: {position: 'none'},
      bar: {groupWidth: "85%"},
      colors:['#4A9218'],
      hAxis: {
                  viewWindowMode: 'explicit',
                  viewWindow: {
                               max: 400,
                               min: 0,
                               },
                   gridlines: {
                            count: 10,
                              }
                          }          
  };
  var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
  chart.draw(data, options);
  }
  &lt;/script&gt;
  &lt;!--this is the div that will hold the pie chart--&gt;
  &lt;div id="chart_div" style="width:100%; height:200px"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>the Output is simple Barchart, that feed data from MySQL.
  Is it possible an how to:</p>
  
  <pre><code> 1)To change Bar color when selected
   2)To change/populate seperate &lt;div&gt;&lt;/div&gt; content value regarding on selected Bar 
  </code></pre>
  
  <p>For example You click on Bar with value "3"(its dynamic). The Bar change color to red. DIV element below shows value "3"</p>