Skip to content

Instantly share code, notes, and snippets.

@sytpp
Last active January 25, 2018 14:54
Show Gist options
  • Save sytpp/23cbeeb6f76bda08cab2 to your computer and use it in GitHub Desktop.
Save sytpp/23cbeeb6f76bda08cab2 to your computer and use it in GitHub Desktop.
Physician Migration
license: mit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SankeyID1ece7188268a</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
body {
color: #444444;
font-family: Arial,Helvetica,sans-serif;
font-size: 100%;
}
a {
color: #4D87C7;
text-decoration: none;
}
</style>
</head>
<body>
<!-- Sankey generated in R 3.1.0 by googleVis 0.5.9 package -->
<!-- Thu Apr 9 13:16:30 2015 -->
<!-- jsHeader -->
<script type="text/javascript">
// jsData
function gvisDataSankeyID1ece7188268a () {
var data = new google.visualization.DataTable();
var datajson =
[
[
"Ethiopia",
"Canada",
85
],
[
"Ethiopia",
"France",
0
],
[
"Ethiopia",
"Germany",
345
],
[
"Ethiopia",
"United Kingdom",
142
],
[
"Ethiopia",
"United States",
2471
],
[
"Guinea",
"Canada",
0
],
[
"Guinea",
"France",
14
],
[
"Guinea",
"Germany",
9
],
[
"Guinea",
"United Kingdom",
0
],
[
"Guinea",
"United States",
16
],
[
"Kenya",
"Canada",
182
],
[
"Kenya",
"France",
0
],
[
"Kenya",
"Germany",
20
],
[
"Kenya",
"United Kingdom",
548
],
[
"Kenya",
"United States",
950
],
[
"Liberia",
"Canada",
76
],
[
"Liberia",
"France",
0
],
[
"Liberia",
"Germany",
15
],
[
"Liberia",
"United Kingdom",
106
],
[
"Liberia",
"United States",
457
],
[
"Malawi",
"Canada",
0
],
[
"Malawi",
"France",
0
],
[
"Malawi",
"Germany",
0
],
[
"Malawi",
"United Kingdom",
96
],
[
"Malawi",
"United States",
6
],
[
"Sierra Leone",
"Canada",
0
],
[
"Sierra Leone",
"France",
0
],
[
"Sierra Leone",
"Germany",
37
],
[
"Sierra Leone",
"United Kingdom",
25
],
[
"Sierra Leone",
"United States",
11
],
[
"Tanzania",
"Canada",
75
],
[
"Tanzania",
"France",
0
],
[
"Tanzania",
"Germany",
5
],
[
"Tanzania",
"United Kingdom",
275
],
[
"Tanzania",
"United States",
208
],
[
"Zambia",
"Canada",
64
],
[
"Zambia",
"France",
0
],
[
"Zambia",
"Germany",
2
],
[
"Zambia",
"United Kingdom",
691
],
[
"Zambia",
"United States",
698
]
];
data.addColumn('string','CountryName');
data.addColumn('string','variable');
data.addColumn('number','migration');
data.addRows(datajson);
return(data);
}
// jsDrawChart
function drawChartSankeyID1ece7188268a() {
var data = gvisDataSankeyID1ece7188268a();
var options = {};
options["width"] = 900;
options["height"] = 350;
options["sankey"] = {link:{color:{fill:'lightblue'}}};
var chart = new google.visualization.Sankey(
document.getElementById('SankeyID1ece7188268a')
);
chart.draw(data,options);
}
// jsDisplayChart
(function() {
var pkgs = window.__gvisPackages = window.__gvisPackages || [];
var callbacks = window.__gvisCallbacks = window.__gvisCallbacks || [];
var chartid = "sankey";
// Manually see if chartid is in pkgs (not all browsers support Array.indexOf)
var i, newPackage = true;
for (i = 0; newPackage && i < pkgs.length; i++) {
if (pkgs[i] === chartid)
newPackage = false;
}
if (newPackage)
pkgs.push(chartid);
// Add the drawChart function to the global list of callbacks
callbacks.push(drawChartSankeyID1ece7188268a);
})();
function displayChartSankeyID1ece7188268a() {
var pkgs = window.__gvisPackages = window.__gvisPackages || [];
var callbacks = window.__gvisCallbacks = window.__gvisCallbacks || [];
window.clearTimeout(window.__gvisLoad);
// The timeout is set to 100 because otherwise the container div we are
// targeting might not be part of the document yet
window.__gvisLoad = setTimeout(function() {
var pkgCount = pkgs.length;
google.load("visualization", "1", { packages:pkgs, callback: function() {
if (pkgCount != pkgs.length) {
// Race condition where another setTimeout call snuck in after us; if
// that call added a package, we must not shift its callback
return;
}
while (callbacks.length > 0)
callbacks.shift()();
} });
}, 100);
}
// jsFooter
</script>
<!-- jsChart -->
<script type="text/javascript" src="https://www.google.com/jsapi?callback=displayChartSankeyID1ece7188268a"></script>
<!-- divChart -->
<div id="SankeyID1ece7188268a"
style="width: 900; height: 350;">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment