f5ef65207b0f0638134fbc5c99102493b1510804
[ptitvelo/web/www.git] / www / plugins-dist / statistiques / prive / stats / visites.html
1 <!--[if IE]>[<script type="text/javascript" src="(#CHEMIN{javascript/excanvas.js})"></script>]<![endif]-->
2 [<script type="text/javascript" src="(#CHEMIN{javascript/jquery.flot.js})"></script>]
3 [<script type="text/javascript" src="(#CHEMIN{javascript/jquery.flot.selection.js})"></script>]
4 [<script type="text/javascript" src="(#CHEMIN{javascript/jquery.tflot.js})"></script>]
5
6 <script type="text/javascript">
7
8 function trace_stats_table(table, classes, options) {
9 $table = $(table);
10 if ($table.is(':hidden')) {
11 return true; // pas a faire ou deja fait.
12 }
13
14 // copier le titre des tableaux
15 titre = $table.find("caption").text();
16 $table
17 .before("<h3 class='caption'>" + titre + "</h3>")
18 .wrap("<div class='" + classes + "'></div>");
19
20 // mettre les visites avec un fond colore pour le graphique
21 $table.find("thead th:eq(1)").data({fill: true, serie: 'bar', color: '#FFD845'});
22 $table.find("thead th:eq(2)").data({serie: 'line', color: '#7FC4FF'});
23 $table.find("thead th:eq(3)").data({fill: true, serie: 'bar', color: '#A9DD3A'});
24
25 // mettre les previsions en premier
26 // (pour que les autres graph passent par dessus)
27 $table.find('thead tr th:first-child').after(function(){
28 return $(this).parent().find('th:eq(3)').detach();
29 });
30 $table.find('tbody tr th:first-child').after(function(){
31 return $(this).parent().find('td:last-child').detach();
32 });
33
34 params = {
35 legendeExterne:true,
36 legendeActions:true,
37 width:($('.large #page').length)?'695px':'500px', // 795px, 600px (sans le tableau de resume) ...
38 height:'250px',
39 modeDate:true,
40 zoom:true,
41 parse:{
42 axeOnTitle:true,
43 defaultSerie:{
44 bars:{show:true},
45 lines:{show:true},
46 points:{show:false}
47 }
48 },
49 flot:{
50 xaxis:{
51 labelWidth:45,
52 monthNames: [
53 '[(#VAL{2000-01-01}|nom_mois)]',
54 '[(#VAL{2000-02-01}|nom_mois)]',
55 '[(#VAL{2000-03-01}|nom_mois)]',
56 '[(#VAL{2000-04-01}|nom_mois)]',
57 '[(#VAL{2000-05-01}|nom_mois)]',
58 '[(#VAL{2000-06-01}|nom_mois)]',
59 '[(#VAL{2000-07-01}|nom_mois)]',
60 '[(#VAL{2000-08-01}|nom_mois)]',
61 '[(#VAL{2000-09-01}|nom_mois)]',
62 '[(#VAL{2000-10-01}|nom_mois)]',
63 '[(#VAL{2000-11-01}|nom_mois)]',
64 '[(#VAL{2000-12-01}|nom_mois)]'
65 ]
66 }
67 },
68 infobulle:{show:true}
69 }
70
71 $table.tFlot($.extend(true, {}, params, options));
72 }
73
74 function trace_stats(){
75 trace_stats_table(
76 "#visites_quotidiennes",
77 "statistiques_visites_quotidiennes statistiques_visites",
78 {
79 grille:{weekend:true},
80 flot:{
81 xaxis:{
82 minTickSize: [1, "day"]
83 },
84 bars:{barWidth:24 * 60 * 60 * 1000}
85 }
86 });
87
88 trace_stats_table(
89 "#visites_mensuelles",
90 "statistiques_visites_mensuelles statistiques_visites", {
91 grille:{years:true},
92 flot:{
93 xaxis:{
94 timeformat:"%b %y",
95 minTickSize: [1, "month"]
96 },
97 bars:{barWidth:30 * 24 * 60 * 60 * 1000 /* nb de jours... approximatif */}
98 }
99 });
100
101 }
102 (function($){
103 $(document).ready(function(){
104 trace_stats();
105 onAjaxLoad(trace_stats);
106 });
107 })(jQuery);
108 </script>