title: Styling a Column in Google Chats with Json - PHP
body: <p>I am trying to use style "text-align: center" only on one column from the table (for example the slice's column in my code), but I only found how to add it in the Google Charts function. I didnt find anything showing how to do it with Ajax and Json.</p>
  
  <p>I am calling the Google Charts in the Main.php. </p>
  
  <p>And I am using Ajax to get the data from the Ajax.php file, using PHP and Arrays to create a Json.</p>
  
  <p>Main.php</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
     &lt;script type="text/javascript" src="https://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script type='text/javascript' src='../../jquery-1.11.1.min.js'&gt;&lt;/script&gt;
      &lt;script type='text/javascript'&gt;
  
     // Load the Visualization API and the piechart package.
     google.load('visualization', '1', {'packages':['table']});
  
     // Set a callback to run when the Google Visualization API is loaded.
     google.setOnLoadCallback(drawChart);
  
     function drawChart() {
        //$('#chart_div').html("&lt;img src='carregando.gif'&gt;");
       var jsonData = $.ajax({
           url: "ajax.php",
           dataType:"json",
           async: false
           }).responseText;
       // Create our data table out of JSON data loaded from server.
       var data = new google.visualization.DataTable(jsonData);
       // Instantiate and draw our chart, passing in some options.
       var chart = new google.visualization.Table(document.getElementById('chart_div'));
       chart.draw(data, {width: 200});
     }
  
      &lt;/script&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div id="chart_div"&gt;&lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Ajax.php</p>
  
  <pre><code>&lt;?php 
  
  $table = array();
  $table['cols'] = array(
      array('label' =&gt; 'Topping', 'type' =&gt; 'string'),
      array('label' =&gt; 'Slices', 'type' =&gt; 'number')
  
  );
  
  $rows = array();
  
  $temp = array();
  $temp[] = array('v' =&gt; 'Mushrooms');
  $temp[] = array('v' =&gt; 3);
  $rows[] = array('c' =&gt; $temp);
  
  $temp = array();
  $temp[] = array('v' =&gt; 'Onions');
  $temp[] = array('v' =&gt; 1);
  $rows[] = array('c' =&gt; $temp);
  
  $table['rows'] = $rows;
  
  $jsontable = json_encode($table);
  
  echo $jsontable;
  
  ?&gt;
  </code></pre>