SHARE
TWEET

Google chart

a guest Nov 14th, 2013 1,561 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  2. <script type="text/javascript">
  3.   google.load("visualization", "1", {packages:["corechart"]});
  4.   google.setOnLoadCallback(drawChart);
  5.   function drawChart() {
  6.     var data = google.visualization.arrayToDataTable([
  7.  
  8.     ['Country', 'MW'],
  9.  
  10.         <?php if(get_field('country_chart')): ?>
  11.         <?php while(has_sub_field('country_chart')): ?>
  12.  
  13.       ['<?php the_sub_field('country_name'); ?>', <?php the_sub_field('number_of_mw'); ?>],
  14.  
  15.     <?php endwhile; ?>
  16.                 <?php endif; ?>
  17.  
  18.     ]);
  19.  
  20.     var options = {
  21.         chartArea:{left:0,top:20,width:"65%",height:"65%"},
  22.         legend:{alignment: "center",position:"labeled"},
  23.         toolip:{text: "both"},
  24.         pieSliceText: "value",
  25.         pieHole: 0.7,
  26.         colors:['#bcd444','#a6a8aa','#f38135','#9d2434','#78ba4d','#ffc935'],
  27.     };
  28.  
  29.     var chart = new google.visualization.PieChart(document.getElementById('piechart'));
  30.     chart.draw(data, options);
  31.   }
  32. </script>
  33. <h6><?php the_field('chart_title'); ?></h6>
  34. <div id="piechart" style="width: 900px; height: 500px;"></div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top