The code below is meant to draw 2 pie charts in 2 different divs. When staging it will load 1 piechart but not the other and which one it decides to load is COMPLETELY random.
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load Charts and the corechart package.
google.charts.load('current', {'packages':['corechart']});
// Draw the pie chart for Sarah's pizza when Charts is loaded.
google.charts.setOnLoadCallback(drawPVPChart);
// Draw the pie chart for the Anthony's pizza when Charts is loaded.
google.charts.setOnLoadCallback(drawPVEChart);
// Callback that draws the pie chart for Sarah's pizza.
function drawPVPChart() {
var data = google.visualization.arrayToDataTable([
['Effort', 'Amount given'],
['My all', 76],
['Pve', 6],
]);
var options = {
slices: [{color: '#0e2229'}, {color: 'transparent'}, {}, {color: 'transparent'}],
pieHole: 0.8,
pieSliceTextStyle: {
color: '#0e2229',
fontName: 'oswald',
fontSize: 30
},
legend: 'none'
};
var chart = new google.visualization.PieChart(document.getElementById('runthis'));
chart.draw(data, options);
}
// Callback that draws the pie chart for Anthony's pizza.
function drawPVEChart() {
var data = google.visualization.arrayToDataTable([
['Effort', 'Amount given'],
['My all', 76],
['Pve', 30],
]);
var options = {
slices: [{color: '#0e2229'}, {color: 'transparent'}, {}, {color: 'transparent'}],
pieHole: 0.8,
pieSliceTextStyle: {
color: '#0e2229',
fontName: 'oswald',
fontSize: 30
},
legend: 'none'
};
var chart = new google.visualization.PieChart(document.getElementById('runthisnow'));
chart.draw(data, options);
}
</script>
Here is my site Read-Only: LINK
(how to share your site Read-Only link)