Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (52 sloc) 2.66 KB
{% extends "index.html" %}
{% block graphs %}
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.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', 'Languages');
data.addColumn('number', 'Usage');
data.addColumn({type: 'number', role: 'tooltip'});
data.addRows( {{ language_data | safe }} );
// Set chart options
var options = {'title':'Most used languages on Twitter: All Tweets',
'width':800,
'height':600,
sliceVisibilityThreshold: .01,
is3D: true};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
// ------------------------------------------------------------------//
// ------------------------------------------------------------------//
var data2 = new google.visualization.DataTable();
data2.addColumn('string', 'Languages');
data2.addColumn('number', 'Usage');
data2.addColumn({type: 'number', role: 'annotation'});
data2.addRows( {{ top_language_data | safe }} );
// Set chart options
var options2 = {'title':'Most used languages on Twitter: Top Tweets',
'width':800,
'height':600,
pieHole: 0.4};
// Instantiate and draw our chart, passing in some options.
var chart2 = new google.visualization.PieChart(document.getElementById('chart_div2'));
chart2.draw(data2, options2);
// ------------------------------------------------------------------//
// ------------------------------------------------------------------//
}
</script>
{% endblock %}
{% block div %}
<b>Most used languages on Twitter: All Tweets</b>
<div id="chart_div"></div>
<div id="chart_div2"></div>
{% endblock %}