first commit
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - bars
|
||||
*
|
||||
* Google Visualization bar chart demonstration
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Setup module
|
||||
// ------------------------------
|
||||
|
||||
var GoogleBarBasic = function() {
|
||||
|
||||
|
||||
//
|
||||
// Setup module components
|
||||
//
|
||||
|
||||
// Bar chart
|
||||
var _googleBarBasic = function() {
|
||||
if (typeof google == 'undefined') {
|
||||
console.warn('Warning - Google Charts library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize chart
|
||||
google.charts.load('current', {
|
||||
callback: function () {
|
||||
|
||||
// Draw chart
|
||||
drawBar();
|
||||
|
||||
// Resize on sidebar width change
|
||||
$(document).on('click', '.sidebar-control', drawBar);
|
||||
|
||||
// Resize on window resize
|
||||
var resizeBarBasic;
|
||||
$(window).on('resize', function() {
|
||||
clearTimeout(resizeBarBasic);
|
||||
resizeBarBasic = setTimeout(function () {
|
||||
drawBar();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
packages: ['corechart']
|
||||
});
|
||||
|
||||
// Chart settings
|
||||
function drawBar() {
|
||||
|
||||
// Define charts element
|
||||
var bar_chart_element = document.getElementById('google-bar');
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Year', 'Sales', 'Expenses'],
|
||||
['2004', 1000, 400],
|
||||
['2005', 1170, 460],
|
||||
['2006', 660, 1120],
|
||||
['2007', 1030, 540]
|
||||
]);
|
||||
|
||||
|
||||
// Options
|
||||
var options_bar = {
|
||||
fontName: 'Roboto',
|
||||
height: 400,
|
||||
fontSize: 12,
|
||||
chartArea: {
|
||||
left: '5%',
|
||||
width: '94%',
|
||||
height: 350
|
||||
},
|
||||
tooltip: {
|
||||
textStyle: {
|
||||
fontName: 'Roboto',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
vAxis: {
|
||||
gridlines:{
|
||||
color: '#e5e5e5',
|
||||
count: 10
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'center',
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Draw chart
|
||||
var bar = new google.visualization.BarChart(bar_chart_element);
|
||||
bar.draw(data, options_bar);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Return objects assigned to module
|
||||
//
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
_googleBarBasic();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
// Initialize module
|
||||
// ------------------------------
|
||||
|
||||
GoogleBarBasic.init();
|
||||
@@ -0,0 +1,124 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - stacked bars
|
||||
*
|
||||
* Google Visualization stacked bar chart demonstration
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Setup module
|
||||
// ------------------------------
|
||||
|
||||
var GoogleBarStacked = function() {
|
||||
|
||||
|
||||
//
|
||||
// Setup module components
|
||||
//
|
||||
|
||||
// Stacked bar chart
|
||||
var _googleBarStacked = function() {
|
||||
if (typeof google == 'undefined') {
|
||||
console.warn('Warning - Google Charts library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize chart
|
||||
google.charts.load('current', {
|
||||
callback: function () {
|
||||
|
||||
// Draw chart
|
||||
drawBarStacked();
|
||||
|
||||
// Resize on sidebar width change
|
||||
$(document).on('click', '.sidebar-control', drawBarStacked);
|
||||
|
||||
// Resize on window resize
|
||||
var resizeBarStacked;
|
||||
$(window).on('resize', function() {
|
||||
clearTimeout(resizeBarStacked);
|
||||
resizeBarStacked = setTimeout(function () {
|
||||
drawBarStacked();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
packages: ['corechart']
|
||||
});
|
||||
|
||||
// Chart settings
|
||||
function drawBarStacked() {
|
||||
|
||||
// Define charts element
|
||||
var bar_stacked_element = document.getElementById('google-bar-stacked');
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General', 'Western', 'Literature', { role: 'annotation' } ],
|
||||
['2000', 20, 30, 35, 40, 45, 30, ''],
|
||||
['2005', 14, 20, 25, 30, 48, 30, ''],
|
||||
['2010', 10, 24, 20, 32, 18, 5, ''],
|
||||
['2015', 15, 25, 30, 35, 20, 15, ''],
|
||||
['2020', 16, 22, 23, 30, 16, 9, ''],
|
||||
['2025', 12, 26, 20, 40, 20, 30, ''],
|
||||
['2030', 28, 19, 29, 30, 12, 13, '']
|
||||
]);
|
||||
|
||||
|
||||
// Options
|
||||
var options_bar_stacked = {
|
||||
fontName: 'Roboto',
|
||||
height: 400,
|
||||
fontSize: 12,
|
||||
chartArea: {
|
||||
left: '5%',
|
||||
width: '94%',
|
||||
height: 350
|
||||
},
|
||||
isStacked: true,
|
||||
tooltip: {
|
||||
textStyle: {
|
||||
fontName: 'Roboto',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
hAxis: {
|
||||
gridlines:{
|
||||
color: '#e5e5e5',
|
||||
count: 10
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'center',
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Draw chart
|
||||
var bar_stacked = new google.visualization.BarChart(bar_stacked_element);
|
||||
bar_stacked.draw(data, options_bar_stacked);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Return objects assigned to module
|
||||
//
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
_googleBarStacked();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
// Initialize module
|
||||
// ------------------------------
|
||||
|
||||
GoogleBarStacked.init();
|
||||
@@ -0,0 +1,124 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - columns
|
||||
*
|
||||
* Google Visualization column chart demonstration
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Setup module
|
||||
// ------------------------------
|
||||
|
||||
var GoogleColumnBasic = function() {
|
||||
|
||||
|
||||
//
|
||||
// Setup module components
|
||||
//
|
||||
|
||||
// Column chart
|
||||
var _googleColumnBasic = function() {
|
||||
if (typeof google == 'undefined') {
|
||||
console.warn('Warning - Google Charts library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize chart
|
||||
google.charts.load('current', {
|
||||
callback: function () {
|
||||
|
||||
// Draw chart
|
||||
drawColumn();
|
||||
|
||||
// Resize on sidebar width change
|
||||
$(document).on('click', '.sidebar-control', drawColumn);
|
||||
|
||||
// Resize on window resize
|
||||
var resizeColumn;
|
||||
$(window).on('resize', function() {
|
||||
clearTimeout(resizeColumn);
|
||||
resizeColumn = setTimeout(function () {
|
||||
drawColumn();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
packages: ['corechart']
|
||||
});
|
||||
|
||||
// Chart settings
|
||||
function drawColumn() {
|
||||
|
||||
// Define charts element
|
||||
var line_chart_element = document.getElementById('google-column');
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Year', 'Sales', 'Expenses'],
|
||||
['2004', 1000, 400],
|
||||
['2005', 1170, 460],
|
||||
['2006', 660, 1120],
|
||||
['2007', 1030, 540]
|
||||
]);
|
||||
|
||||
|
||||
// Options
|
||||
var options_column = {
|
||||
fontName: 'Roboto',
|
||||
height: 400,
|
||||
fontSize: 12,
|
||||
chartArea: {
|
||||
left: '5%',
|
||||
width: '94%',
|
||||
height: 350
|
||||
},
|
||||
tooltip: {
|
||||
textStyle: {
|
||||
fontName: 'Roboto',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
vAxis: {
|
||||
title: 'Sales and Expenses',
|
||||
titleTextStyle: {
|
||||
fontSize: 13,
|
||||
italic: false
|
||||
},
|
||||
gridlines:{
|
||||
color: '#e5e5e5',
|
||||
count: 10
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'center',
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Draw chart
|
||||
var column = new google.visualization.ColumnChart(line_chart_element);
|
||||
column.draw(data, options_column);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Return objects assigned to module
|
||||
//
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
_googleColumnBasic();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
// Initialize module
|
||||
// ------------------------------
|
||||
|
||||
GoogleColumnBasic.init();
|
||||
@@ -0,0 +1,128 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - stacked columns
|
||||
*
|
||||
* Google Visualization stacked column chart demonstration
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Setup module
|
||||
// ------------------------------
|
||||
|
||||
var GoogleColumnStacked = function() {
|
||||
|
||||
|
||||
//
|
||||
// Setup module components
|
||||
//
|
||||
|
||||
// Stacked column chart
|
||||
var _googleColumnStacked = function() {
|
||||
if (typeof google == 'undefined') {
|
||||
console.warn('Warning - Google Charts library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize chart
|
||||
google.charts.load('current', {
|
||||
callback: function () {
|
||||
|
||||
// Draw chart
|
||||
drawColumnStacked();
|
||||
|
||||
// Resize on sidebar width change
|
||||
$(document).on('click', '.sidebar-control', drawColumnStacked);
|
||||
|
||||
// Resize on window resize
|
||||
var resizeColumnStacked;
|
||||
$(window).on('resize', function() {
|
||||
clearTimeout(resizeColumnStacked);
|
||||
resizeColumnStacked = setTimeout(function () {
|
||||
drawColumnStacked();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
packages: ['corechart']
|
||||
});
|
||||
|
||||
// Chart settings
|
||||
function drawColumnStacked() {
|
||||
|
||||
// Define charts element
|
||||
var column_stacked_element = document.getElementById('google-column-stacked');
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General', 'Western', 'Literature', { role: 'annotation' } ],
|
||||
['2000', 20, 30, 35, 40, 45, 30, ''],
|
||||
['2005', 14, 20, 25, 30, 48, 30, ''],
|
||||
['2010', 10, 24, 20, 32, 18, 5, ''],
|
||||
['2015', 15, 25, 30, 35, 20, 15, ''],
|
||||
['2020', 16, 22, 23, 30, 16, 9, ''],
|
||||
['2025', 12, 26, 20, 40, 20, 30, ''],
|
||||
['2030', 28, 19, 29, 30, 12, 13, '']
|
||||
]);
|
||||
|
||||
|
||||
// Options
|
||||
var options_column_stacked = {
|
||||
fontName: 'Roboto',
|
||||
height: 400,
|
||||
fontSize: 12,
|
||||
chartArea: {
|
||||
left: '5%',
|
||||
width: '94%',
|
||||
height: 350
|
||||
},
|
||||
isStacked: true,
|
||||
tooltip: {
|
||||
textStyle: {
|
||||
fontName: 'Roboto',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
vAxis: {
|
||||
title: 'Sales and Expenses',
|
||||
titleTextStyle: {
|
||||
fontSize: 13,
|
||||
italic: false
|
||||
},
|
||||
gridlines:{
|
||||
color: '#e5e5e5',
|
||||
count: 10
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'center',
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Draw chart
|
||||
var column_stacked = new google.visualization.ColumnChart(column_stacked_element);
|
||||
column_stacked.draw(data, options_column_stacked);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Return objects assigned to module
|
||||
//
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
_googleColumnStacked();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
// Initialize module
|
||||
// ------------------------------
|
||||
|
||||
GoogleColumnStacked.init();
|
||||
@@ -0,0 +1,127 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - chart combinations
|
||||
*
|
||||
* Google Visualization combo chart demonstration
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Setup module
|
||||
// ------------------------------
|
||||
|
||||
var GoogleComboChart = function() {
|
||||
|
||||
|
||||
//
|
||||
// Setup module components
|
||||
//
|
||||
|
||||
// Combo chart
|
||||
var _googleComboChart = function() {
|
||||
if (typeof google == 'undefined') {
|
||||
console.warn('Warning - Google Charts library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize chart
|
||||
google.charts.load('current', {
|
||||
callback: function () {
|
||||
|
||||
// Draw chart
|
||||
drawCombo();
|
||||
|
||||
// Resize on sidebar width change
|
||||
$(document).on('click', '.sidebar-control', drawCombo);
|
||||
|
||||
// Resize on window resize
|
||||
var resizeCombo;
|
||||
$(window).on('resize', function() {
|
||||
clearTimeout(resizeCombo);
|
||||
resizeCombo = setTimeout(function () {
|
||||
drawCombo();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
packages: ['corechart']
|
||||
});
|
||||
|
||||
// Chart settings
|
||||
function drawCombo() {
|
||||
|
||||
// Define charts element
|
||||
var combo_chart_element = document.getElementById('google-combo');
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', 'Average'],
|
||||
['2004/05', 165, 938, 522, 998, 450, 614.6],
|
||||
['2005/06', 135, 1120, 599, 1268, 288, 682],
|
||||
['2006/07', 157, 1167, 587, 807, 397, 623],
|
||||
['2007/08', 139, 1110, 615, 968, 215, 609.4],
|
||||
['2008/09', 136, 691, 629, 1026, 366, 569.6]
|
||||
]);
|
||||
|
||||
|
||||
// Options
|
||||
var options_combo = {
|
||||
fontName: 'Roboto',
|
||||
height: 400,
|
||||
fontSize: 12,
|
||||
chartArea: {
|
||||
left: '5%',
|
||||
width: '94%',
|
||||
height: 350
|
||||
},
|
||||
seriesType: "bars",
|
||||
series: {
|
||||
5: {
|
||||
type: "line",
|
||||
pointSize: 5
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
textStyle: {
|
||||
fontName: 'Roboto',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
vAxis: {
|
||||
gridlines:{
|
||||
color: '#e5e5e5',
|
||||
count: 10
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'center',
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Draw chart
|
||||
var combo = new google.visualization.ComboChart(combo_chart_element);
|
||||
combo.draw(data, options_combo);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Return objects assigned to module
|
||||
//
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
_googleComboChart();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
// Initialize module
|
||||
// ------------------------------
|
||||
|
||||
GoogleComboChart.init();
|
||||
@@ -0,0 +1,155 @@
|
||||
/* ------------------------------------------------------------------------------
|
||||
*
|
||||
* # Google Visualization - histogram
|
||||
*
|
||||
* Google Visualization histogram demonstration
|
||||
*
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
// Setup module
|
||||
// ------------------------------
|
||||
|
||||
var GoogleHistogram = function() {
|
||||
|
||||
|
||||
//
|
||||
// Setup module components
|
||||
//
|
||||
|
||||
// Histogram
|
||||
var _googleHistogram = function() {
|
||||
if (typeof google == 'undefined') {
|
||||
console.warn('Warning - Google Charts library is not loaded.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize chart
|
||||
google.charts.load('current', {
|
||||
callback: function () {
|
||||
|
||||
// Draw chart
|
||||
drawHistogram();
|
||||
|
||||
// Resize on sidebar width change
|
||||
$(document).on('click', '.sidebar-control', drawHistogram);
|
||||
|
||||
// Resize on window resize
|
||||
var resizeHistogram;
|
||||
$(window).on('resize', function() {
|
||||
clearTimeout(resizeHistogram);
|
||||
resizeHistogram = setTimeout(function () {
|
||||
drawHistogram();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
packages: ['corechart']
|
||||
});
|
||||
|
||||
// Chart settings
|
||||
function drawHistogram() {
|
||||
|
||||
// Define charts element
|
||||
var histogram_chart_element = document.getElementById('google-histogram');
|
||||
|
||||
// Data
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Dinosaur', 'Length'],
|
||||
['Acrocanthosaurus (top-spined lizard)', 12.2],
|
||||
['Albertosaurus (Alberta lizard)', 9.1],
|
||||
['Allosaurus (other lizard)', 12.2],
|
||||
['Apatosaurus (deceptive lizard)', 22.9],
|
||||
['Archaeopteryx (ancient wing)', 0.9],
|
||||
['Argentinosaurus (Argentina lizard)', 36.6],
|
||||
['Baryonyx (heavy claws)', 9.1],
|
||||
['Brachiosaurus (arm lizard)', 30.5],
|
||||
['Ceratosaurus (horned lizard)', 6.1],
|
||||
['Coelophysis (hollow form)', 2.7],
|
||||
['Compsognathus (elegant jaw)', 0.9],
|
||||
['Deinonychus (terrible claw)', 2.7],
|
||||
['Diplodocus (double beam)', 27.1],
|
||||
['Dromicelomimus (emu mimic)', 3.4],
|
||||
['Gallimimus (fowl mimic)', 5.5],
|
||||
['Mamenchisaurus (Mamenchi lizard)', 21.0],
|
||||
['Megalosaurus (big lizard)', 7.9],
|
||||
['Microvenator (small hunter)', 1.2],
|
||||
['Ornithomimus (bird mimic)', 4.6],
|
||||
['Oviraptor (egg robber)', 1.5],
|
||||
['Plateosaurus (flat lizard)', 7.9],
|
||||
['Sauronithoides (narrow-clawed lizard)', 2.0],
|
||||
['Seismosaurus (tremor lizard)', 45.7],
|
||||
['Spinosaurus (spiny lizard)', 12.2],
|
||||
['Supersaurus (super lizard)', 30.5],
|
||||
['Tyrannosaurus (tyrant lizard)', 15.2],
|
||||
['Ultrasaurus (ultra lizard)', 30.5],
|
||||
['Velociraptor (swift robber)', 1.8]]
|
||||
);
|
||||
|
||||
|
||||
// Options
|
||||
var options_histogram = {
|
||||
fontName: 'Roboto',
|
||||
height: 400,
|
||||
fontSize: 12,
|
||||
chartArea: {
|
||||
left: '5%',
|
||||
width: '94%',
|
||||
height: 350
|
||||
},
|
||||
isStacked: true,
|
||||
tooltip: {
|
||||
textStyle: {
|
||||
fontName: 'Roboto',
|
||||
fontSize: 13
|
||||
}
|
||||
},
|
||||
vAxis: {
|
||||
title: 'Dinosaur length',
|
||||
titleTextStyle: {
|
||||
fontSize: 13,
|
||||
italic: false
|
||||
},
|
||||
gridlines:{
|
||||
color: '#e5e5e5',
|
||||
count: 10
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
hAxis: {
|
||||
gridlines:{
|
||||
color: '#e5e5e5'
|
||||
},
|
||||
minValue: 0
|
||||
},
|
||||
legend: {
|
||||
position: 'top',
|
||||
alignment: 'center',
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Draw chart
|
||||
var histogram = new google.visualization.Histogram(histogram_chart_element);
|
||||
histogram.draw(data, options_histogram);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Return objects assigned to module
|
||||
//
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
_googleHistogram();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
// Initialize module
|
||||
// ------------------------------
|
||||
|
||||
GoogleHistogram.init();
|
||||
Reference in New Issue
Block a user