Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (70 sloc) 3.21 KB
<html>
<head>
<!-- use google's version of jquery.js instead of a local copy -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
// Get list of ViewportBackgroundColor items from rhinotest database
var vpbackground_data;
var commandprompt_data;
$(document).ready( function()
{
var url = "https://stevebaer.cloudant.com/rhinotest/_design/test/_view/ViewportBackgroundColor?group=true&callback=?";
$.getJSON(url,
function(data){
vpbackground_data = data;
});
url = "https://stevebaer.cloudant.com/rhinotest/_design/test/_view/CommandPromptBackgroundColor?group=true&callback=?";
$.getJSON(url,
function (data) {
commandprompt_data = data;
});
});
</script>
<!--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', {'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 our data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'ViewportBackgroundColor');
data.addColumn('number', 'Count');
for (var i = 0; i < vpbackground_data.rows.length; i++) {
data.addRow([vpbackground_data.rows[i].key, vpbackground_data.rows[i].value]);
}
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('viewport_background_chart_div'));
var _c = new Array();
for (var i = 0; i < vpbackground_data.rows.length; i++) {
_c[i] = vpbackground_data.rows[i].key;
}
chart.draw(data, { width: 600, height: 400, is3D: true, title: "Viewport background color", colors: _c });
data = new google.visualization.DataTable();
data.addColumn('string', 'CommandPromptBackgroundColor');
data.addColumn('number', 'Count');
for (var i = 0; i < commandprompt_data.rows.length; i++) {
data.addRow([commandprompt_data.rows[i].key, commandprompt_data.rows[i].value]);
}
chart = new google.visualization.PieChart(document.getElementById('command_prompt_background_chart_div'));
_c = new Array();
for (var i = 0; i < commandprompt_data.rows.length; i++) {
_c[i] = commandprompt_data.rows[i].key;
}
chart.draw(data, { width: 600, height: 400, is3D: true, title: "Command prompt background color", colors: _c });
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<h1>Appearance Settings Summary</h1>
<div id="viewport_background_chart_div"></div>
<hr />
<div id="command_prompt_background_chart_div"></div>
</body>
</html>