first commit

This commit is contained in:
dev-chiefworks
2022-05-31 16:21:53 -04:00
commit f76abffdcd
5978 changed files with 1078901 additions and 0 deletions
@@ -0,0 +1,152 @@
/* ------------------------------------------------------------------------------
*
* # Google Visualization - candlestick
*
* Google Visualization candlestick chart demonstration
*
* ---------------------------------------------------------------------------- */
// Setup module
// ------------------------------
var GoogleCandlestickChart = function() {
//
// Setup module components
//
// Candlestick chart
var _googleCandlestickChart = 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
drawCandlestick();
// Resize on sidebar width change
$(document).on('click', '.sidebar-control', drawCandlestick);
// Resize on window resize
var resizeCandlestickChart;
$(window).on('resize', function() {
clearTimeout(resizeCandlestickChart);
resizeCandlestickChart = setTimeout(function () {
drawCandlestick();
}, 200);
});
},
packages: ['corechart']
});
// Chart settings
function drawCandlestick() {
// Define charts element
var candlestick_chart_element = document.getElementById('google-candlestick');
// Data
var data = google.visualization.arrayToDataTable([
['1', 20, 28, 38, 45],
['2', 31, 38, 55, 66],
['3', 50, 55, 77, 80],
['4', 77, 77, 66, 50],
['5', 68, 66, 22, 15],
['6', 12, 25, 40, 60],
['7', 10, 69, 39, 90],
['8', 18, 56, 62, 80],
['9', 10, 12, 40, 59],
['10', 30, 36, 48, 55],
['11', 78, 66, 42, 35],
['12', 32, 35, 46, 32],
['13', 65, 23, 54, 23],
['14', 60, 54, 43, 30],
['15', 12, 23, 45, 50],
['16', 4, 15, 60, 45],
['17', 5, 23, 25, 40],
['18', 90, 56, 45, 23],
['19', 65, 55, 45, 25],
['20', 43, 35, 23, 2],
['21', 12, 36, 58, 69],
['22', 18, 26, 46, 60],
['23', 60, 56, 23, 10],
['24', 45, 23, 11, 1],
['25', 4, 19, 40, 65],
['26', 50, 40, 22, 12],
['27', 67, 55, 34, 20],
['28', 4, 12, 45, 68],
['29', 34, 35, 56, 60],
['30', 53, 20, 12, 2],
['31', 25, 35, 45, 55]
// Treat first row as data as well.
], true);
// Options
var options = {
fontName: 'Roboto',
height: 400,
fontSize: 12,
chartArea: {
left: '5%',
width: '94%',
height: 350
},
colors: ['#546E7A'],
candlestick: {
risingColor: {
fill: '#546E7A',
stroke: '#546E7A'
}
},
tooltip: {
textStyle: {
fontName: 'Roboto',
fontSize: 13
}
},
vAxis: {
title: 'Income and Expenses',
titleTextStyle: {
fontSize: 13,
italic: false
},
gridlines:{
color: '#e5e5e5',
count: 10
},
minValue: 0
},
legend: 'none'
};
// Draw chart
var candlestick = new google.visualization.CandlestickChart(candlestick_chart_element);
candlestick.draw(data, options);
}
};
//
// Return objects assigned to module
//
return {
init: function() {
_googleCandlestickChart();
}
}
}();
// Initialize module
// ------------------------------
GoogleCandlestickChart.init();
@@ -0,0 +1,146 @@
/* ------------------------------------------------------------------------------
*
* # Google Visualization - diff chart
*
* Google Visualization diff chart demonstration
*
* ---------------------------------------------------------------------------- */
// Setup module
// ------------------------------
var GoogleDiffChart = function() {
//
// Setup module components
//
// Diff chart
var _googleDiffChart = 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
drawDiff();
// Resize on sidebar width change
$(document).on('click', '.sidebar-control', drawDiff);
// Resize on window resize
var resizeDiffChart;
$(window).on('resize', function() {
clearTimeout(resizeDiffChart);
resizeDiffChart = setTimeout(function () {
drawDiff();
}, 200);
});
},
packages: ['corechart']
});
// Chart settings
function drawDiff() {
// Define charts element
var diff_chart_element = document.getElementById('google-diff');
// Old data
var oldData = google.visualization.arrayToDataTable([
['Name', 'Popularity'],
['Cesar', 425],
['Rachel', 420],
['Patrick', 290],
['Eric', 620],
['Eugene', 520],
['John', 460],
['Greg', 420],
['Matt', 410]
]);
// New data
var newData = google.visualization.arrayToDataTable([
['Name', 'Popularity'],
['Cesar', 307],
['Rachel', 360],
['Patrick', 200],
['Eric', 550],
['Eugene', 460],
['John', 320],
['Greg', 390],
['Matt', 360]
]);
// Options
var options = {
fontName: 'Roboto',
height: 400,
fontSize: 12,
chartArea: {
left: '5%',
width: '94%',
height: 350
},
colors: ['#4CAF50'],
tooltip: {
textStyle: {
fontName: 'Roboto',
fontSize: 13
}
},
vAxis: {
title: 'Popularity',
titleTextStyle: {
fontSize: 13,
italic: false
},
gridlines:{
color: '#e5e5e5',
count: 10
},
minValue: 0
},
legend: {
position: 'top',
alignment: 'end',
textStyle: {
fontSize: 12
}
}
};
// Attach chart to the DOM element
var diff = new google.visualization.ColumnChart(diff_chart_element);
// Set data
var diffData = diff.computeDiff(oldData, newData);
// Draw our chart, passing in some options
diff.draw(diffData, options);
}
};
//
// Return objects assigned to module
//
return {
init: function() {
_googleDiffChart();
}
}
}();
// Initialize module
// ------------------------------
GoogleDiffChart.init();
@@ -0,0 +1,102 @@
/* ------------------------------------------------------------------------------
*
* # Google Visualization - geo chart
*
* Google Visualization geo chart demonstration
*
* ---------------------------------------------------------------------------- */
// Setup module
// ------------------------------
var GoogleGeoRegion = function() {
//
// Setup module components
//
// Geo chart
var _googleGeoRegion = 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
drawRegionsMap();
// Resize on sidebar width change
$(document).on('click', '.sidebar-control', drawRegionsMap);
// Resize on window resize
var resizeGeoRegion;
$(window).on('resize', function() {
clearTimeout(resizeGeoRegion);
resizeGeoRegion = setTimeout(function () {
drawRegionsMap();
}, 200);
});
},
packages: ['corechart']
});
// Chart settings
function drawRegionsMap() {
// Define charts element
var geo_region_element = document.getElementById('google-geo-region');
// Data
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['United States', 300],
['Brazil', 400],
['Canada', 500],
['France', 600],
['RU', 700]
]);
// Options
var options = {
fontName: 'Roboto',
height: 500,
width: "100%",
fontSize: 12,
tooltip: {
textStyle: {
fontName: 'Roboto',
fontSize: 13
}
}
};
// Draw chart
var chart = new google.visualization.GeoChart(geo_region_element);
chart.draw(data, options);
}
};
//
// Return objects assigned to module
//
return {
init: function() {
_googleGeoRegion();
}
}
}();
// Initialize module
// ------------------------------
GoogleGeoRegion.init();
@@ -0,0 +1,151 @@
/* ------------------------------------------------------------------------------
*
* # Google Visualization - sankey diagram
*
* Google Visualization sankey diagram demonstration
*
* ---------------------------------------------------------------------------- */
// Setup module
// ------------------------------
var GoogleSankeyBasic = function() {
//
// Setup module components
//
// Sankey diagram
var _googleSankeyBasic = 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
drawSankey();
// Resize on sidebar width change
$(document).on('click', '.sidebar-control', drawSankey);
// Resize on window resize
var resizeSankeyBasic;
$(window).on('resize', function() {
clearTimeout(resizeSankeyBasic);
resizeSankeyBasic = setTimeout(function () {
drawSankey();
}, 200);
});
},
packages: ['corechart', 'sankey']
});
// Chart settings
function drawSankey() {
// Define charts element
var sankey_chart_element = document.getElementById('google-sankey');
// Data
var data = new google.visualization.DataTable();
data.addColumn('string', 'From');
data.addColumn('string', 'To');
data.addColumn('number', 'Weight');
data.addRows([
[ 'Brazil', 'Portugal', 4 ],
[ 'Brazil', 'France', 1 ],
[ 'Brazil', 'Spain', 1 ],
[ 'Brazil', 'England', 1 ],
[ 'Canada', 'Portugal', 1 ],
[ 'Canada', 'France', 4 ],
[ 'Canada', 'England', 1 ],
[ 'Mexico', 'Portugal', 1 ],
[ 'Mexico', 'France', 1 ],
[ 'Mexico', 'Spain', 4 ],
[ 'Mexico', 'England', 1 ],
[ 'USA', 'Portugal', 1 ],
[ 'USA', 'France', 1 ],
[ 'USA', 'Spain', 1 ],
[ 'USA', 'England', 4 ],
[ 'Portugal', 'Angola', 2 ],
[ 'Portugal', 'Senegal', 1 ],
[ 'Portugal', 'Morocco', 1 ],
[ 'Portugal', 'South Africa', 3 ],
[ 'France', 'Angola', 1 ],
[ 'France', 'Mali', 3 ],
[ 'France', 'Morocco', 3 ],
[ 'France', 'South Africa', 1 ],
[ 'Spain', 'Senegal', 1 ],
[ 'Spain', 'Morocco', 3 ],
[ 'Spain', 'South Africa', 1 ],
[ 'England', 'Angola', 1 ],
[ 'England', 'Senegal', 1 ],
[ 'England', 'Morocco', 2 ],
[ 'England', 'South Africa', 4 ],
[ 'South Africa', 'India', 1 ],
[ 'South Africa', 'Japan', 3 ],
[ 'Angola', 'China', 2 ],
[ 'Angola', 'India', 1 ],
[ 'Angola', 'Japan', 3 ],
[ 'Senegal', 'China', 2 ],
[ 'Senegal', 'India', 1 ],
[ 'Senegal', 'Japan', 3 ],
[ 'Mali', 'China', 2 ],
[ 'Mali', 'India', 1 ],
[ 'Mali', 'Japan', 3 ],
[ 'Morocco', 'China', 2 ],
[ 'Morocco', 'India', 1 ],
[ 'Morocco', 'Japan', 3 ],
[ 'Morocco', 'Senegal', 1 ]
]);
// Options
var options = {
height: 600,
sankey: {
link: {
color: {
fill: '#eee',
fillOpacity: 0.3
}
},
node: {
width: 8,
nodePadding: 80,
label: {
fontName: 'Roboto',
fontSize: 13
}
}
},
};
// Draw chart
var chart = new google.visualization.Sankey(sankey_chart_element);
chart.draw(data, options);
}
};
//
// Return objects assigned to module
//
return {
init: function() {
_googleSankeyBasic();
}
}
}();
// Initialize module
// ------------------------------
GoogleSankeyBasic.init();
@@ -0,0 +1,138 @@
/* ------------------------------------------------------------------------------
*
* # Google Visualization - trendlines
*
* Google Visualization trendline chart demonstration
*
* ---------------------------------------------------------------------------- */
// Setup module
// ------------------------------
var GoogleTrendline = function() {
//
// Setup module components
//
// Trendline chart
var _googleTrendline = 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
drawTrendline();
// Resize on sidebar width change
$(document).on('click', '.sidebar-control', drawTrendline);
// Resize on window resize
var resizeTrendline;
$(window).on('resize', function() {
clearTimeout(resizeTrendline);
resizeTrendline = setTimeout(function () {
drawTrendline();
}, 200);
});
},
packages: ['corechart']
});
// Chart settings
function drawTrendline() {
// Define charts element
var trendline_element = document.getElementById('google-trendline');
// Data
var data = google.visualization.arrayToDataTable([
['Week', 'Bugs', 'Tests'],
[1, 175, 10],
[2, 159, 20],
[3, 126, 35],
[4, 129, 40],
[5, 108, 60],
[6, 92, 70],
[7, 55, 72],
[8, 50, 97]
]);
// Options
var options = {
fontName: 'Roboto',
height: 400,
curveType: 'function',
fontSize: 12,
chartArea: {
left: '5%',
width: '92%',
height: 350
},
hAxis: {
format: '#',
viewWindow: {min: 0, max: 9},
gridlines: {count: 10}
},
vAxis: {
title: 'Bugs and tests',
titleTextStyle: {
fontSize: 13,
italic: false
},
gridlines:{
color: '#e5e5e5',
count: 10
},
minValue: 0
},
colors: ['#6D4C41', '#FB8C00'],
trendlines: {
0: {
labelInLegend: 'Bug line',
visibleInLegend: true,
},
1: {
labelInLegend: 'Test line',
visibleInLegend: true,
}
},
legend: {
position: 'top',
alignment: 'end',
textStyle: {
fontSize: 12
}
}
};
// Draw chart
var trendline = new google.visualization.ColumnChart(trendline_element);
trendline.draw(data, options);
}
};
//
// Return objects assigned to module
//
return {
init: function() {
_googleTrendline();
}
}
}();
// Initialize module
// ------------------------------
GoogleTrendline.init();