Simple piechart test
parent
0bf84d2ce7
commit
82155a7645
|
|
@ -7,14 +7,13 @@
|
||||||
<script src="../../core/lib/customize.js"></script>
|
<script src="../../core/lib/customize.js"></script>
|
||||||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
||||||
<div id="storageInfo"></div>
|
<div id="storageInfo"></div>
|
||||||
|
<div id="piechart" style="width: 900px; height: 500px;"></div>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
google.charts.load('current', {'packages':['corechart']});
|
google.charts.load('current', {'packages':['corechart']});
|
||||||
google.charts.setOnLoadCallback(drawChart);
|
google.charts.setOnLoadCallback(drawChart);
|
||||||
|
|
||||||
function drawChart() {
|
function drawChart() {
|
||||||
|
|
||||||
var data = google.visualization.arrayToDataTable([
|
var data = google.visualization.arrayToDataTable([
|
||||||
['Task', 'Hours per Day'],
|
['Task', 'Hours per Day'],
|
||||||
['Work', 11],
|
['Work', 11],
|
||||||
|
|
@ -25,16 +24,23 @@
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
title: 'App Storage Chart'
|
title: 'My Daily Activities'
|
||||||
};
|
};
|
||||||
|
|
||||||
var chart = new google.visualization.PieChart(document.getElementById('storagePieChart'));
|
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
|
||||||
|
|
||||||
chart.draw(data, options);
|
chart.draw(data, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Called when we know what device we're using
|
// Called when we know what device we're using
|
||||||
function onInit(device) {
|
function onInit(device) {
|
||||||
Util.showModal("Reading Storage...");
|
//Util.showModal("Reading Storage...");
|
||||||
Puck.eval(`require("Storage").list(/\\.info$/).map(appInfoName => {
|
Puck.eval(`require("Storage").list(/\\.info$/).map(appInfoName => {
|
||||||
let appInfo = require("Storage").readJSON(appInfoName,1)||{};
|
let appInfo = require("Storage").readJSON(appInfoName,1)||{};
|
||||||
//print(appInfoName, appInfo);
|
//print(appInfoName, appInfo);
|
||||||
|
|
@ -62,9 +68,7 @@
|
||||||
Util.hideModal();
|
Util.hideModal();
|
||||||
console.log(apps);
|
console.log(apps);
|
||||||
|
|
||||||
//create pie chart
|
|
||||||
document.getElementById("storagePieChart").innerHTML = `
|
|
||||||
<div id="piechart" style="width: 500px; height: 300px;"></div>;
|
|
||||||
document.getElementById("storageInfo").innerHTML = `
|
document.getElementById("storageInfo").innerHTML = `
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue