IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Probabilité de nombre de clic à J+1


Sujet :

JavaScript

  1. #1
    Invité
    Invité(e)
    Par défaut Probabilité de nombre de clic à J+1
    Bonjour !!!

    Bon ben voilà, je voudrais compter le nombre de clics entre 18h et 19h avec javascript, ceci sur une semaine, et calculer la probabilité que ce nombre soit le même la semaine suivante, puis l'afficher à l'écran dans un tableau.

    Quelqu'un aurait il une idée ou je pourrais trouver des codes exemple de probabilités avec Js ?

    merci , bise
    Dernière modification par Invité ; 19/03/2015 à 16h58.

  2. #2
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 637
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 637
    Points : 66 661
    Points
    66 661
    Billets dans le blog
    1
    Par défaut
    => google analytics
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  3. #3
    Invité
    Invité(e)
    Par défaut
    Merci Space Frog, mais je n'ai pas trouvé grand Chose...

    Bon je posterais un semblant de code ici, qui sait quelqu'un pourra me donner des idées. Merci !

  4. #4
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 637
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 637
    Points : 66 661
    Points
    66 661
    Billets dans le blog
    1
    Par défaut
    Avec google analytics tu colles des variable perso sur ta page lors des click ("dimensions personnalisées") et tu les visualises dans google analytics ...
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  5. #5
    Invité
    Invité(e)
    Par défaut
    Voilà, j'ai pondu un code hier en Angular.js et JqueryClique pour le tester : J'ai mis 5h à peu près.

    Donc voilà, c'est un mec il passe par un portique, et le portique le flashe et stocke ça dans un tableau horaire, puis réalise des pourcentages automatiquement !



    Je vous poste mon code : Critiques extremement bienvenues !! Suggestions d'améliorations aussi !


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    <html lang="fr" ng-app="GestionPortique">
    	<head>
    		<meta http-equiv="content-type" content="text/html;charset=iso-8859-15" />
    		<!-- -----------------------------------------------DEBUT DU CHARGEMENT DES LIBRAIRIES------------------------ -->
    		<!--	APPEL LIB ANGULAR -->
    		<script	type="text/javascript" 	src="angular-1.3.13/angular.min.js"></script>
    		<!--	APPEL LIB JQUERY -->
    		<script	type="text/javascript" 	src="librairies/jquery.js"></script>
    		<!-- -----------------------------------------------FIN DU CHARGEMENT DES LIBRAIRIES------------------------ ----->
    		<script>
     
    var myApp = angular.module('GestionPortique',[]);
     
    // Controleur Angular
    myApp.controller('NameCtrl', function($scope) {
     
    	//Initialisation des Variables
    	$scope.Math=Math;
    	$scope.clients	= [0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,10,10,50,5,5,0,0,0,0];	// Initialisation du Nombre de client par heures(données exemples sur 24h, 1 par heure)
    	$scope.prcts	= [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];	 	// Initialisation des pourcentages par heure sur 24h
     
    	// Action sur Clic
    	$scope.augmente	= 	function(){
    						date = new Date;
    						var h = date.getHours();
    						$scope.clients[h] += 1;// Incrémente de 1 le nb de client l'heure ou le clic a été fait.
    						colorDetecteur();
    						$scope.getPourcentage(); // Mets à jour le pourcentage de clients
    						}
     
    	// Total des clients Flashes
    	$scope.getTotal = function(){
    						var total=0;
    						for (x=0;x<24;x++){
    						total += $scope.clients[x];
    						}
    	return total;
    	};
     
    	// POurcentage des clients flashés par heures
    	$scope.getPourcentage = function(){
    						var total=0;
    						var y=$scope.getTotal();
    						for (x=0;x<24;x++){
    						$scope.prcts[x] = ($scope.clients[x]/y*100).toFixed(2);
    						}
    	};
     
    	$scope.getPourcentage(); // Mets à jour les pourcentages.
     
    	function colorDetecteur(){
    		affClient();
    		$("#infos").empty();
    		$("#infos").append('Flash d\'un Client');
    		$(".detecteur").css( 'background-color', 'red' );
    		setTimeout(function() {
    			console.log("Timeout");
    			$("#infos").empty();
    			$("#infos").append('Pas de Client');
    			$(".detecteur").css( 'background-color', 'blue' );
    		}, 700);
    	};	
     
     
    	function affClient(){
    		$(".client").show();
    		setTimeout(function() {
    			$(".client").hide();
    			}, 700);
     
    	}
     
    	$(".client").hide();
     
     
    // Fin du Controleur Angular
    });		
     
    </script>
    </head>
     
    <body ng-controller="NameCtrl" >
     
    <div id="logo"><img src="portic.jpg" class="logo"></div>
     
     
    <div id="a_cliquer" ng-click="augmente()"> 
    	<div id="client" class="client"><img src="client.png"></div>
    	<button ng-click="heure()" class="btn">Flash Client</button>
    	<img src="portique.jpg" style="width:300px;height:300px;"></img>
    	<h1><span id="infos">{{infos}}</span></h1>
    </div>
     
     
     
    <div id="detecteur" class="detecteur" > 
    	<img src="detecteur.jpg" class="img"></img>
    </div>
     
     
     
    <br>
    <div id="stats">
    	<table class="CSSTableGenerator ">
    		<tr>
    			<td>	<img src="horloge.jpg" class="img"></td>
     
    			<td>0h</td>
    			<td>1h</td>
    			<td>2h</td>
    			<td>3h</td>
    			<td>4h</td>
    			<td>5h</td>
    			<td>6h</td>
    			<td>7h</td>
    			<td>8h</td>
    			<td>9h</td>
    			<td>10h</td>
    			<td>11h</td>
    			<td>12h</td>
    			<td>13h</td>
    			<td>14h</td>
    			<td>15h</td>
    			<td>16h</td>
    			<td>17h</td>
    			<td>18h</td>
    			<td>19h</td>
    			<td>20h</td>
    			<td>21h</td>
    			<td>22h</td>
    			<td>23h</td>
    			<td>Total</td>
    			<td>Moyenne</td>
     
    		</tr>
    		<tr >
    			<td><img src="client.png" class="img"></td>
    			<td>{{clients[0]}}</td>
    			<td>{{clients[1]}}</td>
    			<td>{{clients[2]}}</td>
    			<td>{{clients[3]}}</td>
    			<td>{{clients[4]}}</td>
    			<td>{{clients[5]}}</td>
    			<td>{{clients[6]}}</td>
    			<td>{{clients[7]}}</td>
    			<td>{{clients[8]}}</td>
    			<td>{{clients[9]}}</td>
    			<td>{{clients[10]}}</td>
    			<td>{{clients[11]}}</td>
    			<td>{{clients[12]}}</td>
    			<td>{{clients[13]}}</td>
    			<td>{{clients[14]}}</td>
    			<td>{{clients[15]}}</td>
    			<td>{{clients[16]}}</td>
    			<td>{{clients[17]}}</td>
    			<td>{{clients[18]}}</td>
    			<td>{{clients[19]}}</td>
    			<td>{{clients[20]}}</td>
    			<td>{{clients[21]}}</td>
    			<td>{{clients[22]}}</td>
    			<td>{{clients[23]}}</td>
    			<td>{{getTotal()}}</td>
    			<td>{{Math.round(getTotal()/24,2)}}</td>
    		</tr>
    		<tr>
    			<td>	<img src="pourcent.png" class="img"></td>
    			<td>{{prcts[0]}}%</td>
    			<td>{{prcts[1]}}%</td>
    			<td>{{prcts[2]}}%</td>
    			<td>{{prcts[3]}}%</td>
    			<td>{{prcts[4]}}%</td>
    			<td>{{prcts[5]}}%</td>
    			<td>{{prcts[6]}}%</td>
    			<td>{{prcts[7]}}%</td>
    			<td>{{prcts[8]}}%</td>
    			<td>{{prcts[9]}}%</td>
    			<td>{{prcts[10]}}%</td>
    			<td>{{prcts[11]}}%</td>
    			<td>{{prcts[12]}}%</td>
    			<td>{{prcts[13]}}%</td>
    			<td>{{prcts[14]}}%</td>
    			<td>{{prcts[15]}}%</td>
    			<td>{{prcts[16]}}%</td>
    			<td>{{prcts[17]}}%</td>
    			<td>{{prcts[18]}}%</td>
    			<td>{{prcts[19]}}%</td>
    			<td>{{prcts[20]}}%</td>
    			<td>{{prcts[21]}}%</td>
    			<td>{{prcts[22]}}%</td>
    			<td>{{prcts[23]}}%</td>
    			<td>100%		</td>
    			<td>			</td>
    		</tr>
    	</table>
    </div>
     
    </body>
    	<style>
    		.body{
    			font-family:arial;
    			font-size:0.8em;
    			background-color:tan;
    			max-width:1000px;
    		}	
     
    		h1{
     
    		font-size:1.2em;
    		text-align: center;
    		background-color:lightgrey;
    		-webkit-border-radius: 10px 10px 10px 10px;
    		border-radius: 10px 10px 10px 10px;
    		-webkit-box-shadow:inset 2px 2px 2px 2px #635453;
    		box-shadow:inset 2px 2px 2px 2px #635453;
    		}
     
    		p{
    		margin-left:15px;
    		}
     
    		#a_cliquer{
    		height:320px;
    		width:350px;
    		background-color:lightgrey;
    		float:left;
    		<!-- float:center; -->
    		}
     
    		.img{
    		width:50px;
    		height:50px;
     
    		}
     
    		.logo{
    		width:80px;
    		height:80px;
    		}
     
     
    		.detecteur{
    		width:120px;
    		height:120px;
    		float:left;
    		text-align:center;
     
    		}
     
    		#stats{
    		width:383px;
    		height:100px;
    		position:absolute;
    		margin-left:1px;
    		margin-top:350px;
    		 float:left;
    		}
     
    		#client{
    		position:absolute;
    		margin-height:20px;
    		margin-left:100px;
    		margin-top:20px;
    		}
     
    		#logo{
    		position:absolute;
    		margin-height:20px;
    		margin-left:800px;
    		margin-top:20px;
    		height:100px;
     
     
    		}
     
     
    	.CSSTableGenerator {
    	margin:0px;padding:0px;
    	width:100%;
    	box-shadow: 10px 10px 5px #888888;
    	border:1px solid #000000;
     
    	-moz-border-radius-bottomleft:0px;
    	-webkit-border-bottom-left-radius:0px;
    	border-bottom-left-radius:0px;
     
    	-moz-border-radius-bottomright:0px;
    	-webkit-border-bottom-right-radius:0px;
    	border-bottom-right-radius:0px;
     
    	-moz-border-radius-topright:0px;
    	-webkit-border-top-right-radius:0px;
    	border-top-right-radius:0px;
     
    	-moz-border-radius-topleft:0px;
    	-webkit-border-top-left-radius:0px;
    	border-top-left-radius:0px;
    }.CSSTableGenerator table{
        border-collapse: collapse;
            border-spacing: 0;
    	width:100%;
    	height:100%;
    	margin:0px;padding:0px;
    }.CSSTableGenerator tr:last-child td:last-child {
    	-moz-border-radius-bottomright:0px;
    	-webkit-border-bottom-right-radius:0px;
    	border-bottom-right-radius:0px;
    }
    .CSSTableGenerator table tr:first-child td:first-child {
    	-moz-border-radius-topleft:0px;
    	-webkit-border-top-left-radius:0px;
    	border-top-left-radius:0px;
    }
    .CSSTableGenerator table tr:first-child td:last-child {
    	-moz-border-radius-topright:0px;
    	-webkit-border-top-right-radius:0px;
    	border-top-right-radius:0px;
    }.CSSTableGenerator tr:last-child td:first-child{
    	-moz-border-radius-bottomleft:0px;
    	-webkit-border-bottom-left-radius:0px;
    	border-bottom-left-radius:0px;
    }.CSSTableGenerator tr:hover td{
    	background-color:#cccc99;
     
     
    }
    .CSSTableGenerator td{
    	vertical-align:middle;
     
    	background-color:#cccccc;
     
    	border:1px solid #000000;
    	border-width:0px 1px 1px 0px;
    	text-align:left;
    	padding:1px;
    	font-size:10px;
     
    	font-family:Arial;
    	font-weight:normal;
    	color:#000000;
    }.CSSTableGenerator tr:last-child td{
    	border-width:0px 1px 0px 0px;
    }.CSSTableGenerator tr td:last-child{
    	border-width:0px 0px 1px 0px;
    }.CSSTableGenerator tr:last-child td:last-child{
    	border-width:0px 0px 0px 0px;
    }
    .CSSTableGenerator tr:first-child td{
    		background:-o-linear-gradient(bottom, #003366 5%, #003f7f 100%);	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #003366), color-stop(1, #003f7f) );
    	background:-moz-linear-gradient( center top, #003366 5%, #003f7f 100% );
    	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#003366", endColorstr="#003f7f");	background: -o-linear-gradient(top,#003366,003f7f);
     
    	background-color:#003366;
    	border:0px solid #000000;
    	text-align:center;
    	border-width:0px 0px 1px 1px;
    	font-size:10px;
    	font-family:Arial;
    	font-weight:bold;
    	color:#ffffff;
    }
    .CSSTableGenerator tr:first-child:hover td{
    	background:-o-linear-gradient(bottom, #003366 5%, #003f7f 100%);	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #003366), color-stop(1, #003f7f) );
    	background:-moz-linear-gradient( center top, #003366 5%, #003f7f 100% );
    	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#003366", endColorstr="#003f7f");	background: -o-linear-gradient(top,#003366,003f7f);
     
    	background-color:#003366;
    }
    .CSSTableGenerator tr:first-child td:first-child{
    	border-width:0px 0px 1px 0px;
    }
    .CSSTableGenerator tr:first-child td:last-child{
    	border-width:0px 0px 1px 1px;
    }	
     
    .btn {
      background: #323c42;
      background-image: -webkit-linear-gradient(top, #323c42, #2980b9);
      background-image: -moz-linear-gradient(top, #323c42, #2980b9);
      background-image: -ms-linear-gradient(top, #323c42, #2980b9);
      background-image: -o-linear-gradient(top, #323c42, #2980b9);
      background-image: linear-gradient(to bottom, #323c42, #2980b9);
      -webkit-border-radius: 4;
      -moz-border-radius: 4;
      border-radius: 4px;
      text-shadow: 3px 6px 9px #666666;
      font-family: Arial;
      color: #ffffff;
      font-size: 12px;
      padding: 12px 18px 10px 20px;
      border: solid #1f628d 4px;
      text-decoration: none;
     
      position:absolute;
     
    }
     
    .btnspe{
      margin-top:200px; 
     margin-left:330px; 
    }
     
    .btnspe2{
     
     
    }
     
     
    .btn:hover {
      background: #fc6f3c;
      background-image: -webkit-linear-gradient(top, #fc6f3c, #d9349f);
      background-image: -moz-linear-gradient(top, #fc6f3c, #d9349f);
      background-image: -ms-linear-gradient(top, #fc6f3c, #d9349f);
      background-image: -o-linear-gradient(top, #fc6f3c, #d9349f);
      background-image: linear-gradient(to bottom, #fc6f3c, #d9349f);
      text-decoration: none;
    }
     
     
     
     
     
    </style>
     
    </html>

Discussions similaires

  1. compter le nombre de clic sur pub
    Par floboss dans le forum Général JavaScript
    Réponses: 50
    Dernier message: 15/06/2007, 13h18
  2. Limiter le nombre de clic sur un bouton
    Par Sulthisil dans le forum wxWidgets
    Réponses: 2
    Dernier message: 27/05/2007, 23h33
  3. [MySQL] Compter le nombre de clic
    Par fifidelphe dans le forum PHP & Base de données
    Réponses: 11
    Dernier message: 04/05/2006, 10h23
  4. Compter le nombre de clic sur un lien externe
    Par TommyWeb dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 06/04/2006, 12h15
  5. comptez le nombre de clics par user
    Par apprenti-fab dans le forum Langage
    Réponses: 3
    Dernier message: 03/03/2006, 19h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo