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