add chart to short increase of disk space over time

This commit is contained in:
Uwe Steinmann 2024-08-12 10:25:54 +02:00
parent 2d721e542e
commit 7f94f38ed2

View File

@ -90,6 +90,48 @@ if(in_array($type, array('docspermonth'))) {
}
});
<?php
} elseif(in_array($type, array('sizepermonth'))) {
?>
var data = [
<?php
if($data) {
foreach($data as $i=>$rec) {
$key = mktime(12, 0, 0, substr($rec['key'], 5, 2), 1, substr($rec['key'], 0, 4)) * 1000;
echo '["'.$rec['key'].'",'.$rec['total'].'],'."\n";
}
}
?>
];
$.plot("#chart", [data], {
xaxis: {
mode: "categories",
tickLength: 0,
},
series: {
bars: {
show: true,
align: "center",
barWidth: 0.8,
},
},
grid: {
hoverable: true,
clickable: true
}
});
$("#chart").bind("plothover", function (event, pos, item) {
if(item) {
var x = item.datapoint[0];//.toFixed(2),
y = item.datapoint[1];//.toFixed(2);
$("#tooltip").html(item.series.xaxis.ticks[x].label + ": " + formatFileSize(y, false, 2))
.css({top: pos.pageY-35, left: pos.pageX+5})
.fadeIn(200);
} else {
$("#tooltip").hide();
}
});
<?php
} elseif(in_array($type, array('docsaccumulated'))) {
?>
var data = [
@ -208,7 +250,7 @@ $(document).ready( function() {
$this->columnStart(3);
$this->contentHeading(getMLText("chart_selection"));
$this->contentContainerStart();
foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) {
foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'sizepermonth','docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) {
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
}
$this->contentContainerEnd();
@ -265,6 +307,7 @@ $(document).ready( function() {
}
break;
case 'sizeperuser':
case 'sizepermonth':
foreach($data as $item) {
echo "<tr><td>".htmlspecialchars($item['key'])."</td><td>".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td></tr>";
$total += $item['total'];