Ichcha 0 Light Poster

i need help in adding $data into datatable data.setvalue where will be used to generate column chart. first column = x-axis while the rest of the columns = elements. thanks in advance.


// $result already in correct structure.
$data = json_encode($result);

  <script type="text/javascript" src="https://www.google.com/jsapi"></script>    
   <script type="text/javascript">      
    google.load("visualization", "1", {packages:["corechart"]});      
	  function drawChart() {        
	   var data = new google.visualization.DataTable(<?php echo $data ?>);   
	   <?php foreach($data as $row): ?>     
	     data.setValue(<?php echo $row['columnA']; ?>, <?php echo $row['columnB']; ?>,<?php echo $row['columnC']; ?>);    
	   <?php endforeach; ?>   
		 var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));       
			chart.draw(data, {width: 400, height: 240, title: 'Performance',                         
			 hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}                        
 <div id="chart_div"></div>