first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - pie chart
|
||||
*
|
||||
* Google Visualization pie chart demonstration
|
||||
*
|
||||
* Version: 1.0
|
||||
* Latest update: August 1, 2015
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Pie chart
|
||||
// ------------------------------
|
||||
|
||||
// Initialize chart
|
||||
google.load("visualization", "1", {packages:["corechart"]});
|
||||
google.setOnLoadCallback(drawPie);
|
||||
|
||||
|
||||
// Chart settings
|
||||
function drawPie() {
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Task', 'Hours per Day'],
|
||||
['Work', 11],
|
||||
['Eat', 2],
|
||||
['Commute', 2],
|
||||
['Watch TV', 2],
|
||||
['Sleep', 7]
|
||||
]);
|
||||
|
||||
// Options
|
||||
var options_pie = {
|
||||
fontName: 'Roboto',
|
||||
height: 300,
|
||||
width: 500,
|
||||
chartArea: {
|
||||
left: 50,
|
||||
width: '90%',
|
||||
height: '90%'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Instantiate and draw our chart, passing in some options.
|
||||
var pie = new google.visualization.PieChart($('#google-pie')[0]);
|
||||
pie.draw(data, options_pie);
|
||||
}
|
||||
Reference in New Issue
Block a user