Add pie chart on Mime type statistics.

This commit is contained in:
Darold Gilles 2012-12-26 18:11:52 +01:00
parent 50e693b167
commit 0dc0e7a5f6
5 changed files with 43 additions and 2 deletions

View File

@ -124,6 +124,8 @@ my %Translate = (
'File_Generated' => 'File generated by', 'File_Generated' => 'File generated by',
'Up_link' => 'Up', 'Up_link' => 'Up',
'Click_year_stat' => 'Click on year\'s statistics link for details', 'Click_year_stat' => 'Click on year\'s statistics link for details',
'Mime_graph_hits_title' => 'Mime Type Hits Statistics on',
'Mime_graph_bytes_title' => 'Mime Type Bytes Statistiques on',
); );
@ -1510,6 +1512,35 @@ sub _print_mime_stat
# Print title and calendar view # Print title and calendar view
print $out $self->_print_title($Translate{'Mime_title'}, $stat_date); print $out $self->_print_title($Translate{'Mime_title'}, $stat_date);
my %data = ();
$total_count ||= 1;
foreach my $mime (keys %mime_stat) {
if (($mime_stat{$mime}{hits}/$total_count)*100 > $self->{MinPie}) {
$data{$mime} = $mime_stat{$mime}{hits};
} else {
$data{'others'} += $mime_stat{$mime}{hits};
}
}
my $title = "$Translate{'Mime_graph_hits_title'} $stat_date";
my $mime_hits = $self->flotr2_piegraph(1, 'mime_hits', $title, $Translate{'Mime_graph'}, '', %data);
print $out qq{<table class="graphs"><tr><td>$mime_hits</td>};
$mime_hits = '';
%data = ();
$total_bytes ||= 1;
foreach my $mime (keys %mime_stat) {
if (($mime_stat{$mime}{bytes}/$total_bytes)*100 > $self->{MinPie}) {
$data{$mime} = int($mime_stat{$mime}{bytes}/1000000);
} else {
$data{'others'} += $mime_stat{$mime}{bytes};
}
}
$data{'others'} = int($data{'others'}/1000000);
$title = "$Translate{'Mime_graph_bytes_title'} $stat_date";
my $mime_bytes = $self->flotr2_piegraph(1, 'mime_bytes', $title, $Translate{'Mime_graph'}, '', %data);
print $out qq{<td>$mime_bytes</td></tr></table>};
$mime_bytes = '';
%data = ();
print $out "<h3>$Translate{'Mime_number'}: $ntype</h3>\n"; print $out "<h3>$Translate{'Mime_number'}: $ntype</h3>\n";
print $out qq{ print $out qq{
<table class="sortable stata"> <table class="sortable stata">
@ -3069,7 +3100,8 @@ sub flotr2_bargraph
title: "$title", title: "$title",
legend: { legend: {
position: "nw", position: "nw",
backgroundColor: "#D2E8FF" backgroundColor: "#D2E8FF",
backgroundOpacity: 0.4
}, },
HtmlText: false, HtmlText: false,
}; };
@ -3186,7 +3218,8 @@ sub flotr2_piegraph
}, },
legend: { legend: {
position: "sw", position: "sw",
backgroundColor: "#D2E8FF" backgroundColor: "#D2E8FF",
backgroundOpacity: 0.4
} }
}); });
/* /*

View File

@ -99,3 +99,5 @@ Legend Beschriftung
File_Generated Erzeugt durch File_Generated Erzeugt durch
Up_link Zur&uuml;ck zum Anfang der Seite Up_link Zur&uuml;ck zum Anfang der Seite
Click_year_stat Klicken Sie bitte auf den Link mit der gew&uuml;nschten Jahreszahl, um in die Detailanzeige zu gelangen Click_year_stat Klicken Sie bitte auf den Link mit der gew&uuml;nschten Jahreszahl, um in die Detailanzeige zu gelangen
Mime_graph_hits_title Mime Typen Treffer Statistik
Mime_graph_bytes_title Mime Typen Bytes Statistik

View File

@ -99,3 +99,5 @@ Legend Legend
File_Generated File generated by File_Generated File generated by
Up_link Up Up_link Up
Click_year_stat Click on year's statistics link for details Click_year_stat Click on year's statistics link for details
Mime_graph_hits_title Mime Type Hits Statistics on
Mime_graph_bytes_title Mime Type Bytes Statistiques on

View File

@ -99,4 +99,6 @@ Legend L
File_Generated Généré par File_Generated Généré par
Up_link Haut de Page Up_link Haut de Page
Click_year_stat Cliquez sur le lien des statistiques annuelles pour plus de détail Click_year_stat Cliquez sur le lien des statistiques annuelles pour plus de détail
Mime_graph_hits_title Statistiques des requêtes par type MIME pour
Mime_graph_bytes_title Statistiques des transferts par type MIME pour

View File

@ -100,3 +100,5 @@ Legend Legenda
File_Generated Gerado pela File_Generated Gerado pela
Up_link Up Up_link Up
Click_year_stat Click on year's statistics link for details Click_year_stat Click on year's statistics link for details
Mime_graph_hits_title Acessos a Tipos MIME em
Mime_graph_bytes_title Bytes Transferidos de Tipos MIME em