[SPIP] ~version 3.0.7-->3.0.10
[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.siblings('.pagination').before("<h3 class='caption'>" + titre + "</h3>");
17 $table
18
19 .wrap("<div class='" + classes + "'></div>");
20
21 // mettre les visites avec un fond colore pour le graphique
22 $table.find("thead th:eq(1)").data({fill: true, serie: 'bar', color: '#FFD845',lineWidth:0});
23 $table.find("thead th:eq(2)").data({serie: 'line', color: '#7FC4FF'});
24 $table.find("thead th:eq(3)").data({fill: true, serie: 'bar', color: '#A9DD3A',lineWidth:0});
25
26 // mettre les previsions en premier
27 // (pour que les autres graph passent par dessus)
28 $table.find('thead tr th:first-child').after(function(){
29 return $(this).parent().find('th:eq(3)').detach();
30 });
31 $table.find('tbody tr th:first-child').after(function(){
32 return $(this).parent().find('td:last-child').detach();
33 });
34
35 params = {
36 legendeExterne:true,
37 legendeActions:true,
38 width:($('.large #page').length)?'755px':'560px', // 795px, 600px (sans le tableau de resume) ...
39 height:'250px',
40 modeDate:true,
41 zoom:true,
42 parse:{
43 axeOnTitle:true,
44 defaultSerie:{
45 bars:{show:true},
46 lines:{show:true},
47 points:{show:false}
48 }
49 },
50 flot:{
51 grid:{
52 axismargin:10
53 },
54 xaxis:{
55 labelWidth:45,
56 monthNames: [
57 '[(#VAL{2000-01-01}|nom_mois)]',
58 '[(#VAL{2000-02-01}|nom_mois)]',
59 '[(#VAL{2000-03-01}|nom_mois)]',
60 '[(#VAL{2000-04-01}|nom_mois)]',
61 '[(#VAL{2000-05-01}|nom_mois)]',
62 '[(#VAL{2000-06-01}|nom_mois)]',
63 '[(#VAL{2000-07-01}|nom_mois)]',
64 '[(#VAL{2000-08-01}|nom_mois)]',
65 '[(#VAL{2000-09-01}|nom_mois)]',
66 '[(#VAL{2000-10-01}|nom_mois)]',
67 '[(#VAL{2000-11-01}|nom_mois)]',
68 '[(#VAL{2000-12-01}|nom_mois)]'
69 ]
70 },
71 yaxis:{
72 position: "right"
73 }
74 },
75 infobulle:{show:true}
76 }
77
78 $table.tFlot($.extend(true, {}, params, options));
79 }
80
81 function trace_stats(){
82 trace_stats_table(
83 "#visites_quotidiennes",
84 "statistiques_visites_quotidiennes statistiques_visites",
85 {
86 grille:{weekend:true},
87 flot:{
88 xaxis:{
89 timeformat:"%d %b",
90 minTickSize: [1, "day"]
91 },
92 bars:{barWidth:24 * 60 * 60 * 1000}
93 }
94 });
95
96 trace_stats_table(
97 "#visites_mensuelles",
98 "statistiques_visites_mensuelles statistiques_visites", {
99 grille:{years:true},
100 flot:{
101 xaxis:{
102 timeformat:"%b %y",
103 minTickSize: [1, "month"]
104 },
105 bars:{barWidth:30.4 * 24 * 60 * 60 * 1000 /* nb de jours... approximatif */}
106 }
107 });
108
109 }
110 (function($){
111 $(document).ready(function(){
112 trace_stats();
113 onAjaxLoad(trace_stats);
114 });
115 })(jQuery);
116 </script>