mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-22 03:05:28 +01:00
131 lines
3.2 KiB
JavaScript
131 lines
3.2 KiB
JavaScript
|
(function ($) {
|
||
|
'use strict';
|
||
|
google.charts.load('current', {
|
||
|
'packages': ['line']
|
||
|
});
|
||
|
google.charts.setOnLoadCallback(drawChart);
|
||
|
|
||
|
function drawChart() {
|
||
|
|
||
|
var data = new google.visualization.DataTable();
|
||
|
data.addColumn('number', 'Day');
|
||
|
data.addColumn('number', 'Guardians of the Galaxy');
|
||
|
data.addColumn('number', 'The Avengers');
|
||
|
data.addColumn('number', 'Transformers: Age of Extinction');
|
||
|
|
||
|
data.addRows([
|
||
|
[1, 37.8, 80.8, 41.8],
|
||
|
[2, 30.9, 69.5, 32.4],
|
||
|
[3, 25.4, 57, 25.7],
|
||
|
[4, 11.7, 18.8, 10.5],
|
||
|
[5, 11.9, 17.6, 10.4],
|
||
|
[6, 8.8, 13.6, 7.7],
|
||
|
[7, 7.6, 12.3, 9.6],
|
||
|
[8, 12.3, 29.2, 10.6],
|
||
|
[9, 16.9, 42.9, 14.8],
|
||
|
[10, 12.8, 30.9, 11.6],
|
||
|
[11, 5.3, 7.9, 4.7],
|
||
|
[12, 6.6, 8.4, 5.2],
|
||
|
[13, 4.8, 6.3, 3.6],
|
||
|
[14, 4.2, 6.2, 3.4]
|
||
|
]);
|
||
|
|
||
|
var options = {
|
||
|
legend: {
|
||
|
maxLines: 2,
|
||
|
position: 'top'
|
||
|
},
|
||
|
title: 'Box Office Earnings in First Two Weeks of Opening',
|
||
|
subtitle: 'in millions of dollars (USD)'
|
||
|
};
|
||
|
|
||
|
var chart = new google.charts.Line(document.getElementById('line-chart'));
|
||
|
|
||
|
chart.draw(data, google.charts.Line.convertOptions(options));
|
||
|
}
|
||
|
})(jQuery);
|
||
|
|
||
|
|
||
|
(function ($) {
|
||
|
google.charts.load('current', {
|
||
|
'packages': ['bar']
|
||
|
});
|
||
|
google.charts.setOnLoadCallback(drawChart);
|
||
|
|
||
|
function drawChart() {
|
||
|
var data = google.visualization.arrayToDataTable([
|
||
|
['Year', 'Sales', 'Expenses', 'Profit'],
|
||
|
['2014', 1000, 400, 200],
|
||
|
['2015', 1170, 460, 250],
|
||
|
['2016', 660, 1120, 300],
|
||
|
['2017', 1030, 540, 350]
|
||
|
]);
|
||
|
|
||
|
var options = {
|
||
|
chart: {
|
||
|
title: 'Company Performance',
|
||
|
subtitle: 'Sales, Expenses, and Profit: 2014-2017',
|
||
|
},
|
||
|
bars: 'horizontal' // Required for Material Bar Charts.
|
||
|
};
|
||
|
|
||
|
var chart = new google.charts.Bar(document.getElementById('Bar-chart'));
|
||
|
|
||
|
chart.draw(data, google.charts.Bar.convertOptions(options));
|
||
|
}
|
||
|
})(jQuery);
|
||
|
|
||
|
|
||
|
(function ($) {
|
||
|
google.charts.load("current", {
|
||
|
packages: ["corechart"]
|
||
|
});
|
||
|
google.charts.setOnLoadCallback(drawChart);
|
||
|
|
||
|
function drawChart() {
|
||
|
var data = google.visualization.arrayToDataTable([
|
||
|
['Task', 'Hours per Day'],
|
||
|
['Work', 11],
|
||
|
['Eat', 2],
|
||
|
['Commute', 2],
|
||
|
['Watch TV', 2],
|
||
|
['Sleep', 7]
|
||
|
]);
|
||
|
|
||
|
var options = {
|
||
|
title: 'My Daily Activities',
|
||
|
pieHole: 0.4,
|
||
|
};
|
||
|
|
||
|
var chart = new google.visualization.PieChart(document.getElementById('donutchart'));
|
||
|
chart.draw(data, options);
|
||
|
}
|
||
|
})(jQuery);
|
||
|
|
||
|
|
||
|
(function ($) {
|
||
|
google.charts.load("current", {
|
||
|
packages: ["corechart"]
|
||
|
});
|
||
|
google.charts.setOnLoadCallback(drawChart);
|
||
|
|
||
|
function drawChart() {
|
||
|
var data = google.visualization.arrayToDataTable([
|
||
|
['Language', 'Speakers (in millions)'],
|
||
|
['German', 5.85],
|
||
|
['French', 1.66],
|
||
|
['Italian', 0.316],
|
||
|
['Romansh', 0.0791]
|
||
|
]);
|
||
|
|
||
|
var options = {
|
||
|
legend: 'none',
|
||
|
pieSliceText: 'label',
|
||
|
title: 'Swiss Language Use (100 degree rotation)',
|
||
|
pieStartAngle: 100,
|
||
|
};
|
||
|
|
||
|
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
|
||
|
chart.draw(data, options);
|
||
|
}
|
||
|
})(jQuery);
|