Built with blockbuilder.org
Last active
May 18, 2017 18:55
-
-
Save DerekCaelin/e02a8857b93378224ec673acf2f82910 to your computer and use it in GitHub Desktop.
fresh block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | |
<div id="sankey_basic" style="width: 100%; height: 400px;"></div> | |
</head> | |
<body> | |
<script> | |
google.charts.load('current', { | |
'packages': ['sankey'] | |
}); | |
google.charts.setOnLoadCallback(drawChart); | |
function drawChart() { | |
var data = new google.visualization.DataTable(); | |
data.addColumn('string', 'From'); | |
data.addColumn('string', 'To'); | |
data.addColumn('number', 'Weight'); | |
data.addRows([ | |
['Conflicts between Boko Haram and the government', 'Local Government Officials', 44], | |
['Conflicts between Boko Haram and the government', 'National Government Officials', 27], | |
['Conflicts between Boko Haram and the government', 'Police', 74], | |
['Conflicts between Boko Haram and the government', 'Religious Leaders', 61], | |
['Conflicts between Boko Haram and the government', 'State Government Officials', 33], | |
['Conflicts between Boko Haram and the government', 'Traditional or Community Leaders', 133], | |
['Conflicts between farmers and herders or other rural banditry', 'Local Government Officials', 15], | |
['Conflicts between farmers and herders or other rural banditry', 'National Government Officials', 5], | |
['Conflicts between farmers and herders or other rural banditry', 'Police', 43], | |
['Conflicts between farmers and herders or other rural banditry', 'Religious Leaders', 50], | |
['Conflicts between farmers and herders or other rural banditry', 'State Government Officials', 17], | |
['Conflicts between farmers and herders or other rural banditry', 'Traditional or Community Leaders', 124], | |
['Ethnic and Religious Tensions', 'Local Government Officials', 11], | |
['Ethnic and Religious Tensions', 'National Government Officials', 9], | |
['Ethnic and Religious Tensions', 'Police', 57], | |
['Ethnic and Religious Tensions', 'Religious Leaders', 48], | |
['Ethnic and Religious Tensions', 'State Government Officials', 18], | |
['Ethnic and Religious Tensions', 'Traditional or Community Leaders', 77], | |
['Political grievances and economic instability', 'Local Government Officials', 12], | |
['Political grievances and economic instability', 'National Government Officials', 9], | |
['Political grievances and economic instability', 'Police', 28], | |
['Political grievances and economic instability', 'Religious Leaders', 15], | |
['Political grievances and economic instability', 'State Government Officials', 9], | |
['Political grievances and economic instability', 'Traditional or Community Leaders', 38] | |
]); | |
var colors = ['#00cc00', '#0000ff', '#ff6600', '#669999', | |
'#ff33cc', '#ff9933', '#1f78b4', '#ffff00' | |
]; | |
// Sets chart options. | |
var options = { | |
sankey: { | |
node: { | |
colors: colors, | |
label: { | |
fontSize: 14, | |
color: '#871b47', | |
// bold: true, | |
} | |
}, | |
link: { | |
colorMode: 'gradient', | |
colors: colors | |
} | |
} | |
}; | |
// Instantiates and draws our chart, passing in some options. | |
var chart = new google.visualization.Sankey(document.getElementById('sankey_basic')); | |
chart.draw(data, options); | |
} | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment