- Posts: 33
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
google.charts.load('current', {packages: });
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // Load the Visualization API and the piechart package. google.charts.load('current', { packages: ['corechart'] }); google.charts.setOnLoadCallback(drawChart); // Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and draws it. function drawChart() { // Create the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ ['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5] ]); // Set chart options var thiswidth = $('#chart_div').width(); var thisheight =thiswidth * 7/8; var options = { 'title':'How Much Pizza Everyone Ate Last Night', 'width':thiswidth, 'height':thisheight }; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.PieChart(document.getElementById('chart_div')); chart.draw(data, options); } </script> <div id="chart_div" style="width:100%; height:auto"></div>