Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" src="https://www.google.com/jsapi"></script>
- <script type="text/javascript">
- google.load("visualization", "1", {packages:["corechart"]});
- google.setOnLoadCallback(drawChart);
- function drawChart() {
- var data = google.visualization.arrayToDataTable([
- ['Country', 'MW'],
- <?php if(get_field('country_chart')): ?>
- <?php while(has_sub_field('country_chart')): ?>
- ['<?php the_sub_field('country_name'); ?>', <?php the_sub_field('number_of_mw'); ?>],
- <?php endwhile; ?>
- <?php endif; ?>
- ]);
- var options = {
- chartArea:{left:0,top:20,width:"65%",height:"65%"},
- legend:{alignment: "center",position:"labeled"},
- toolip:{text: "both"},
- pieSliceText: "value",
- pieHole: 0.7,
- colors:['#bcd444','#a6a8aa','#f38135','#9d2434','#78ba4d','#ffc935'],
- };
- var chart = new google.visualization.PieChart(document.getElementById('piechart'));
- chart.draw(data, options);
- }
- </script>
- <h6><?php the_field('chart_title'); ?></h6>
- <div id="piechart" style="width: 900px; height: 500px;"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement