Skip to content

Instantly share code, notes, and snippets.

@bniedzie
Created June 10, 2019 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bniedzie/2af7c1c2d24e755e4190b94ab52d0a44 to your computer and use it in GitHub Desktop.
Save bniedzie/2af7c1c2d24e755e4190b94ab52d0a44 to your computer and use it in GitHub Desktop.
Percentage of Uncertain Birth/Death Dates per 50 Year Period
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawBarColors);
function drawBarColors() {
var data = google.visualization.arrayToDataTable([
['Year Range', 'Male', 'Female'],
['550-500', 4.93, 0],
['500-450', 2.13, 28.57],
['450-400', 3.19, 0],
['400-350', 7.6, 0],
['350-300', 7.5, 12.5],
['300-250', 21.27, 14.29],
['250-200', 21.17, 16],
['200-150', 12.74, 11.11],
['150-100', 6.5, 3.6],
['100-50', 8.05, 12.67],
['50-0', 4.78, 0]
]);
var options = {
title: 'Percentage of Uncertain Birth and Death Dates',
chartArea: {width: '60%', top: 35, height: '50%' },
colors: ['#b0120a', '#ffab91'],
bars: 'vertical',
vAxis: {
title: 'Percent',
minValue: 0
},
hAxis: {
title: 'Time Period (BCE)',
titleTextStyle: {color: 'black'},
viewWindowMode: 'pretty',
showTextEvery: 1
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment