Bonjour à tous.

J'ai un truc bizarre : lorsque je change d'année pour mes courbes, les légendes ne se mettent pas dans le bon ordre et je ne vois pas d'où ça vient ?
Nom : eChart06.png
Affichages : 223
Taille : 87,2 Ko

Pour être précis : lorsque ma page se charge, tout se passe bien, mais lorsque je choisi une autre année dans la liste déroulante, je me retrouve avec "2015 - 2017 - 2016".

Je ne doute pas que ça vienne de mon code, mais je n'arrive pas à trouver de solution.

A noter que lorsque je clique sur le bouton "Rechargement", tout revient à la normale.

Merci d'avance pour votre aide.

Code javascript : 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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
 
$(document).ready(function () {
 
	var day = new Date();
	day.setDate(day.getDate() - 1); // On sélectionne le jour précédent
	var mm = ((day.getMonth() + 1) < 10) ? '0' + (day.getMonth() + 1) : (day.getMonth() + 1);
	var dd = (day.getDate() < 10) ? '0' + day.getDate() : day.getDate();
	var yy = day.getFullYear();
	var dayInit = yy + mm + dd;
 
	var WAnneeDeb = 2016;
	i = WAnneeDeb;
	while (i <= yy) {
		$('#Liste_Annee').append($('<option>', {
			value: i,
			text: i
		}));
		i = i + 1;
	}
	var WAnnee = $('#Liste_Annee').val(yy); // Sélection de l'année en cours.
 
	//	dayInit=$('#Liste_Annee').val()+"0101"; // Indispensable pour la compatibilité
	dayInit = $('#Liste_Annee').val();
 
	// Initialisation row  (div) => nombre de lignes qui vont contenir des graph
	//	initHTML(["lfpo", "lfpg", "lfpb_small", "lfob_small"]); // Initialisation row  (div) => nombre de lignes qui vont contenir des graph
	//	initHTML(["LIG_TJ_LFPG", "LIG_TJ_LFPO", "LIG_TJ_LFPB"]); 
	initHTML(["LIG_TJ_LFPG", "LIG_TJ_LFPO", "LIG_TJ_LFPB_LFOB"]);
 
	loadData(dayInit);
 
	$("#Liste_Annee").change(function () {
		var P_Annee = $('#Liste_Annee').val(); // Sélection de l'année en cours.
		loadData(P_Annee);
	});
 
	$("#btn-save-pdf").click(function () {
		saveAsPdf(dayInit);
	});
 
	// Chargement des données
	function loadData(P_date) {
 
		$("#btn-save-pdf").attr("disabled", true);
		$("#div-info").children('.message-p-info').html('<strong>Chargement...</strong>');
		$("#div-info").children('.icon-p-info').html('<i class="fa fa-spinner fa-pulse fa-lg"></i>');
		$(".graph-loading").each(function () {
			$(this).width($(this).prev().width());
			$(this).css("display", "block");
		});
 
		/*----------------------------------------------------------------------------------------------*/
		/* Graph TRAFIC JOURNALIER                                                                      */
		/*----------------------------------------------------------------------------------------------*/
		// Requête au serveur
		Annee = P_date.slice(0, 4);
 
//console.log("WAnneeN="+WAnneeN);
//console.log("WAnneeN1="+WAnneeN1);
//console.log("WAnneeN2="+WAnneeN2);
 
		P_Pltf = "LFPG";
		var deferred = $.get("./scripts/PHP/TraficJournalier_PLTF.php?date=".concat(P_date) + "&pltf=".concat(P_Pltf));
		// Retour du serveur (traitement des données JSON)
		deferred.done(function (jsonData) {
			var update = false;
			if (jsonData[0].length > 0) {
				update = true;
				if ($("#LIG_TJ_LFPG").children().length == 0) {
					addHTML("LIG_TJ_LFPG", ["lfpg_tj"], ["12"]); // Graph de gauche=LFPB / Graph de droite=LFOB
				}
				createGraph_TJ("LFPG", Annee, jsonData[0], jsonData[1], jsonData[2]);
				$("#lfpg_tj").removeClass("no-data"); // pour supprimer la classe
			} else {
				//				$("#LIG_TJ_LFPG").empty();
				if (jsonData[0].length == 0) {
					if ($("#lfpg_tj").size() != 1) { // si la div #lfpg_hg existe déjà, pas la peine de la recréer.
						addHTML("LIG_TJ_LFPG", ["lfpg_tj"], ["12"]);
					}
					createGraph_TJ("LFPG", Annee, jsonData[0], jsonData[1], jsonData[2]);
					$("#lfpg_tj").addClass("no-data"); // pour ajouter la classe
				}
			}
			if (update) {
				$(".graph-loading").hide();
				$("#btn-save-pdf").attr("disabled", false);
				$("#div-info").children('.message-p-info').html('');
				$("#div-info").children('.icon-p-info').html('');
			} else {
				$(".graph-loading").hide();
				$("#div-info").children('.message-p-info').html('<strong>Certaines données sont indisponibles...</strong>');
				$("#div-info").children('.icon-p-info').html('<i class="fa fa-exclamation-triangle fa-lg"></i>');
			}
		});
 
		P_Pltf = "LFPO";
		var deferred = $.get("./scripts/PHP/TraficJournalier_PLTF.php?date=".concat(P_date) + "&pltf=".concat(P_Pltf));
		// Retour du serveur (traitement des données JSON)
		deferred.done(function (jsonData) {
			var update = false;
			if (jsonData[0].length > 0) {
				update = true;
				if ($("#LIG_TJ_LFPO").children().length == 0) {
					//					addHTML("lfob", ["lfob_hg"], ["12"]); // on se place dans le div row ID="lfob", on crée une div lfob_hg col-md-12
					addHTML("LIG_TJ_LFPO", ["lfpo_tj"], ["12"]); // Graph de gauche=LFPB / Graph de droite=LFOB
				}
				createGraph_TJ("LFPO", Annee, jsonData[0], jsonData[1], jsonData[2]);
				$("#lfpo_tj").removeClass("no-data"); // pour supprimer la classe
			} else {
				//				$("#LIG_TJ_LFPO").empty();
				if (jsonData[0].length == 0) {
					if ($("#lfpo_tj").size() != 1) { // si la div #lfpg_hg existe déjà, pas la peine de la recréer.
						addHTML("LIG_TJ_LFPG", ["lfpo_tj"], ["12"]);
					}
					createGraph_TJ("LFPO", Annee, jsonData[0], jsonData[1], jsonData[2]);
					$("#lfpo_tj").addClass("no-data"); // pour ajouter la classe
				}
			}
			if (update) {
				$(".graph-loading").hide();
				$("#btn-save-pdf").attr("disabled", false);
				$("#div-info").children('.message-p-info').html('');
				$("#div-info").children('.icon-p-info').html('');
			} else {
				$(".graph-loading").hide();
				$("#div-info").children('.message-p-info').html('<strong>Certaines données sont indisponibles...</strong>');
				$("#div-info").children('.icon-p-info').html('<i class="fa fa-exclamation-triangle fa-lg"></i>');
			}
		});
 
		P_Pltf = "LFPB";
		var deferred = $.get("./scripts/PHP/TraficJournalier_PLTF.php?date=".concat(P_date) + "&pltf=".concat(P_Pltf));
		// Retour du serveur (traitement des données JSON)
		deferred.done(function (jsonData) {
			var update = false;
			if (jsonData[0].length > 0) {
				update = true;
				if ($("#LIG_TJ_LFPB_LFOB").children().length == 0) {
					//					addHTML("lfob", ["lfob_hg"], ["12"]); // on se place dans le div row ID="lfob", on crée une div lfob_hg col-md-12
					addHTML("LIG_TJ_LFPB_LFOB", ["lfpb_tj_left", "lfob_tj_right"], ["6", "6"]); // Graph de gauche=LFPB / Graph de droite=LFOB
				}
				createGraph_TJ("LFPB", Annee, jsonData[0], jsonData[1], jsonData[2]);
			} else {
				//				$("#LIG_TJ_LFPB_LFOB").empty();
				if (jsonData[0].length == 0) {
					if ($("#lfpb_tj_left").size() != 1) { // si la div #lfpg_hg existe déjà, pas la peine de la recréer.
						addHTML("LIG_TJ_LFPB_LFOB", ["lfpb_tj_left", "lfob_tj_right"], ["6", "6"]); // Graph de gauche=LFPB / Graph de droite=LFOB
					}
					createGraph_TJ("LFOB", Annee, jsonData[0], jsonData[1], jsonData[2]);
					$("#lfpb_tj_left").addClass("no-data"); // pour ajouter la classe
				}
			}
			if (update) {
				$(".graph-loading").hide();
				$("#btn-save-pdf").attr("disabled", false);
				$("#div-info").children('.message-p-info').html('');
				$("#div-info").children('.icon-p-info').html('');
			} else {
				$(".graph-loading").hide();
				$("#div-info").children('.message-p-info').html('<strong>Certaines données sont indisponibles...</strong>');
				$("#div-info").children('.icon-p-info').html('<i class="fa fa-exclamation-triangle fa-lg"></i>');
			}
		});
 
		P_Pltf = "LFOB";
		var deferred = $.get("./scripts/PHP/TraficJournalier_PLTF.php?date=".concat(P_date) + "&pltf=".concat(P_Pltf));
		// Retour du serveur (traitement des données JSON)
		deferred.done(function (jsonData) {
			var update = false;
			if (jsonData[0].length > 0) {
				update = true;
				if ($("#LIG_TJ_LFPB_LFOB").children().length == 0) {
					//					addHTML("lfob", ["lfob_hg"], ["12"]); // on se place dans le div row ID="lfob", on crée une div lfob_hg col-md-12
					addHTML("LIG_TJ_LFPB_LFOB", ["lfpb_tj_left", "lfob_tj_right"], ["6", "6"]); // Graph de gauche=LFPB / Graph de droite=LFOB
				}
				createGraph_TJ("LFOB", Annee, jsonData[0], jsonData[1], jsonData[2]);
			} else {
				//				$("#LIG_TJ_LFPB_LFOB").empty();
				if (jsonData[0].length == 0) {
					if ($("#lfob_tj_right").size() != 1) { // si la div #lfpg_hg existe déjà, pas la peine de la recréer.
						addHTML("LIG_TJ_LFPB_LFOB", ["lfpb_tj_left", "lfob_tj_right"], ["6", "6"]); // Graph de gauche=LFPB / Graph de droite=LFOB
					}
					createGraph_TJ("LFOB", Annee, jsonData[0], jsonData[1], jsonData[2]);
					$("#lfob_tj_right").addClass("no-data"); // pour ajouter la classe
				}
			}
			if (update) {
				$(".graph-loading").hide();
				$("#btn-save-pdf").attr("disabled", false);
				$("#div-info").children('.message-p-info').html('');
				$("#div-info").children('.icon-p-info').html('');
			} else {
				$(".graph-loading").hide();
				$("#div-info").children('.message-p-info').html('<strong>Certaines données sont indisponibles...</strong>');
				$("#div-info").children('.icon-p-info').html('<i class="fa fa-exclamation-triangle fa-lg"></i>');
			}
		});
	}
 
	/*----------------------------------------------------------------------------------------------*/
	/* VARIABLES GLOBALES CONSTANTES POUR LES GRAPHES                                               */
	/*----------------------------------------------------------------------------------------------*/
 
	var WLigneCSV = "DATES;" + (Annee - 2) + ";" + (Annee - 1) + ";" + Annee + "\n";
 
	var WPaddingTexte_xAxis = 20;
	var WPaddingTexte_yAxis = 20;
	var P_AxeTextSize = 15;
	var P_TextColor = "#5d6d7e"; // gris légèrement foncé
	var P_CoulFond = "#ffffff"; // blanc
	var P_Colors = ["#FE0000"]; // rouge
	var P_TAB_Colors = ['#ff0000', '#0000FF', '#008000']; // Couleur des courbes => ROUGE, BLEU, VERT
 
	/*----------------------------------------------------------------------------------------------*/
	/* Graph TRAFIC JOURNALIER - GRAND                                                              */
	/*----------------------------------------------------------------------------------------------*/
	function createGraph_TJ(P_Plateforme, P_Annee, jsonData_N, jsonData_N1, jsonData_N2) {
		var i = 0,
			sepDate = " ", // Séparateur utilisé dans les dates lues dans la BDD.
			WAnneeN = parseInt(P_Annee),
			WAnneeN1 = P_Annee - 1,
			WAnneeN2 = P_Annee - 2,
			WJourN2 = 0,
			WJourN1 = 0,
			WJourN = 0,
			WMin = 0,
			WMax = 0,
			WDerNumJour = 0,
			SerieChoisie = "",
			QuadrillageVertical = [],
			DateMouv = [],
			MoisMouv_X = [],
			Jours_X = [],
			NbMouvN_Y = [],
			NbMouvN1_Y = [],
			NbMouvN2_Y = [];
 
		// Remplissage des tableaux
		if (jsonData_N2.length > 0) {
			i = 0;
			SerieChoisie = "";
			WMax = 0;
			WMin = parseInt(jsonData_N2[0][3]);
			while (i < jsonData_N2.length) {
				var WNbMouv_N2 = parseInt(jsonData_N2[i][3]);
				WNbMouv_N2 = WNbMouv_N2 + parseInt(jsonData_N2[i + 1][3]);
				WMax = MinMax(WNbMouv_N2, WMax, "MAX");
				WMin = MinMax(WNbMouv_N2, WMin, "MIN");
				NbMouvN2_Y.push(WNbMouv_N2);
				WJourN2 = WJourN2 + 1;
				i += 2; // Il faut avancer de 2 car il y a 1 ligne pour sens="A" et 1 ligne pour sens="D"
			}
			SerieChoisie = "N2";
		}
		if (jsonData_N1.length > 0) {
			i = 0;
			while (i < jsonData_N1.length) {
				var WNbMouv_N1 = parseInt(jsonData_N1[i][3]);
				WNbMouv_N1 = WNbMouv_N1 + parseInt(jsonData_N1[i + 1][3]);
				WMax = MinMax(WNbMouv_N1, WMax, "MAX");
				WMin = MinMax(WNbMouv_N1, WMin, "MIN");
				NbMouvN1_Y.push(WNbMouv_N1);
				WJourN1 = WJourN1 + 1;
				i += 2; // Il faut avancer de 2 car il y a 1 ligne pour sens="A" et 1 ligne pour sens="D"
			}
			if (jsonData_N1.length >= jsonData_N2.length) {
				SerieChoisie = "N1";
			}
		}
		if (jsonData_N.length > 0) {
			i = 0;
			while (i < jsonData_N.length) {
				var WNbMouv_N = parseInt(jsonData_N[i][3]);
				WNbMouv_N = WNbMouv_N + parseInt(jsonData_N[i + 1][3]);
				WMax = MinMax(WNbMouv_N, WMax, "MAX");
				WMin = MinMax(WNbMouv_N, WMin, "MIN");
				NbMouvN_Y.push(WNbMouv_N);
				WJourN = WJourN + 1;
				i += 2; // Il faut avancer de 2 car il y a 1 ligne pour sens="A" et 1 ligne pour sens="D"
			}
			if (jsonData_N.length >= jsonData_N1.length) {
				SerieChoisie = "N";
			}
		}
 
		// Traitement pour l'axe des X
		// Il faut déterminer quelle série va servir pour l'axe des X.
		if (SerieChoisie == "N") {
			WNbJourTot = jsonData_N.length;
		}
		if (SerieChoisie == "N1") {
			WNbJourTot = jsonData_N1.length;
		}
		if (SerieChoisie == "N2") {
			WNbJourTot = jsonData_N2.length;
		}
		if (SerieChoisie == "") {
			WNbJourTot = 0;
		}
		i = 0;
		WNumJour = 0;
		while (i <= WNbJourTot - 1) {
			if (SerieChoisie == "N") {
				var WJour = jsonData_N[i][0].slice(8, 10);
				var WMois = jsonData_N[i][0].slice(5, 7);
				var WJourSemaine = JourEnLettres(jsonData_N[i][0]);
			}
			if (SerieChoisie == "N1") {
				var WJour = jsonData_N1[i][0].slice(8, 10);
				var WMois = jsonData_N1[i][0].slice(5, 7);
				var WJourSemaine = JourEnLettres(jsonData_N1[i][0]);
			}
			if (SerieChoisie == "N2") {
				var WJour = jsonData_N2[i][0].slice(8, 10);
				var WMois = jsonData_N2[i][0].slice(5, 7);
				var WJourSemaine = JourEnLettres(jsonData_N2[i][0]);
			}
			WMois = MoisEnLettres(WMois);
			QuadrillageVertical.push({
				xAxis: "01" + sepDate + WMois
			});
			//			var WDateMouv = WJour + " " + WMois;// + " (Jour N° " + (parseInt(WNumJour) + 1) + ")"; 
			var WDateMouv = WJourSemaine + " " + WJour + " " + WMois; // + " (Jour N° " + (parseInt(WNumJour) + 1) + ")"; 
			Jours_X.push(WNumJour);
			DateMouv.push(WDateMouv);
			MoisMouv_X.push(WMois);
			WNumJour = WNumJour + 1;
			i = i + 2;
		}
 
		// Récupération du dernier jour de l'année N traité pour placer le DataZoom
		WDerNumJour = WJourN;
		WDebZoom = ((WDerNumJour * 100) / 365) - 25;
		WFinZoom = ((WDerNumJour * 100) / 365) + 15;
		if (WDebZoom < 0) {
			WDebZoom = 0; // 0%
			WFinZoom = 33; // 33%
		}
 
		if (P_Plateforme == "LFPO") {
			var TJ_Chart_C1 = echarts.init(document.getElementById("lfpo_tj")); //
			val = ($("#lfpo_tj").width() / 37);
			padding_array = [0, 0, 0, val]; // [haut, droit, bas, gauche]
			P_Titre = "LFPO - " + WAnneeN + " - " + WAnneeN1 + " - " + WAnneeN2;
			var P_CoulFondGraph = "#E1FFE9";
		}
		if (P_Plateforme == "LFPG") {
			var TJ_Chart_C2 = echarts.init(document.getElementById("lfpg_tj")); //
			val = ($("#lfpg_tj").width() / 37);
			padding_array = [0, 0, 0, val]; // [haut, droit, bas, gauche]
			P_Titre = "LFPG - " + WAnneeN + " - " + WAnneeN1 + " - " + WAnneeN2;
			var P_CoulFondGraph = "#FFFFD8"; //"#FFF7FC"; //"#FFFFC8";
		}
		if (P_Plateforme == "LFPB") {
			var TJ_Chart_C3 = echarts.init(document.getElementById("lfpb_tj_left")); //
			val = ($("#lfpb_tj_left").width() / 37);
			padding_array = [0, 0, 0, val]; // [haut, droit, bas, gauche]
			P_Titre = "LFPB - " + WAnneeN + " - " + WAnneeN1 + " - " + WAnneeN2;
			var P_CoulFondGraph = "#DDF6FF";
		}
		if (P_Plateforme == "LFOB") {
			var TJ_Chart_C4 = echarts.init(document.getElementById("lfob_tj_right")); //
			val = ($("#lfob_tj_right").width() / 37);
			padding_array = [0, 0, 0, val]; // [haut, droit, bas, gauche]
			P_Titre = "LFOB - " + WAnneeN + " - " + WAnneeN1 + " - " + WAnneeN2;
			var P_CoulFondGraph = "#FEEDED";
		}
 
//console.log("Jours_X="+JSON.stringify( Jours_X));
//console.log("NbMouvN_Y="+JSON.stringify( NbMouvN_Y));
//console.log("NbMouvN1_Y="+JSON.stringify( NbMouvN1_Y));
//console.log("NbMouvN2_Y="+JSON.stringify( NbMouvN2_Y));
 
 
		var TJ_ChartOpt = {
			backgroundColor: P_CoulFond,
			color: P_TAB_Colors,
			textStyle: {
				fontFamily: 'sans-serif'
			},
			animation: true,
			title: {
				padding: [15, 0, 0, 0], // Title space around content // [haut, droit, bas, gauche]
				left: 'center', // Distance between grid component and the left side of the container
				text: P_Titre,
				textStyle: {
					color: '#000',
					fontStyle: 'normal',
					fontWeight: 'bold',
					fontFamily: 'sans-serif',
					fontSize: 20,
				}
			},
			grid: {
				show: true,							// Whether to show the grid in rectangular coordinate
				backgroundColor: P_CoulFondGraph, // fond du graphe
				top: 70,								// Distance between grid component and the top side of the container
				bottom: 85,								// Distance between grid component and the bottom side of the container
				left: 70,								// Distance between grid component and the left side of the container
				right: 30								// Distance between grid component and the right side of the container
			},
			legend: {
				show: true,
				type : 'plain',
				orient: 'horizontal',
				borderColor: '#95a5a6',
				borderWidth: 0, // Permet de ne pas avoir de bordure sans supprimer les paramètres.
				borderRadius: 7,
				shadowColor: 'rgba(0, 0, 0, 0.5)',
				shadowBlur: 10,
				itemWidth: 30,
				itemHeight: 11,
				left: 'center',
				top: 40
			},
			axisPointer: {
				show: true,
				lineStyle: {
					type: 'dashed',
					width: 1 // Epaisseur de la ligne verticale
				},
				label: {
					backgroundColor: '#777'
				}
			},
			xAxis: { // The X axis in Cartesian (rect.) coordinate
				splitArea: { // Permet de mettre un fond de couleurs différentes
					show: false,
					areaStyle: {
						color: ['rgba(144,238,144,0.3)', 'rgba(135,200,250,0.3)']
					}
				},
				axisLine: {
					lineStyle: {
						color: 'rgb(105,105,105)',
						width: 2,
						onZero: true,
					}
				},
				type: 'category',
				name: 'Mois',
				nameLocation: 'center',
				nameTextStyle: {
					padding: 10, // Espace entre le libellé et la ligne de l'axe X
					fontWeight: 'bold',
					color: P_TextColor,
					fontSize: P_AxeTextSize
				},
				max: 'dataMax',
				position: 'bottom',
				boundaryGap: false, // IMPORTANT ! A Mettre à FALSE pour éviter le décalage
				// Affichage du trait repère
				axisTick: {
					/**
					 * Pour affichage du trait repère sur l'axe X le 1er du mois
					 * @param {object} index  - index du tableau de données traité
					 * @param {object} valeur - valeur correspondante du tableau de données au format xx-mois
					 */
					interval: function (index, valeur) {
						// récup du jour
						valeur = DateMouv[index]; // contient PAR EX dimanche 23 juillet
						var jour = valeur ? valeur.split(sepDate)[1] * 1 : 1;
						if (1 === jour) {
							return true;
						}
					}
				},
				// Affichage du label
				axisLabel: {
					/**
					 * Pour affichage du label au milieu du mois, on met 15 pour simplifier
					 * @param {object} index  - index du tableau de données traité
					 * @param {object} valeur - valeur correspondante du tableau de données au format xx-mois
					 * Nota : le return true entraine l'appel de la fonction de formatage
					 */
					align: "center",
					padding: padding_array, // [haut, droit, bas, gauche] -> centrage des mois dans chaque colonne
					interval: function (index, valeur) {
						// récup du jour
						valeur = DateMouv[index]; // contient PAR EX dimanche 23 juillet
						var jour = valeur ? valeur.split(sepDate)[1] * 1 : 15;
						if (15 === jour) {
							return true;
						}
					},
					formatter: function (index, valeur) {
						// récup du mois pour affichage
						valeur = DateMouv[index]; // contient PAR EX dimanche 23 juillet
						return valeur ? valeur.split(sepDate)[2] : "";
					},
				},
				splitLine: {
					show: true, // True => quadrillage VERTICAL sur le graphe
					lineStyle: {
						color: "#CCC",
						type: "dotted",
						width: 1
					},
					interval: function (index, valeur) {
						// récup du jour
						valeur = DateMouv[index]; // contient PAR EX dimanche 23 juillet
						var jour = valeur ? valeur.split(sepDate)[1] * 1 : 1;
						if (1 === jour) {
							return true;
						}
					}
				},
				axisPointer: {
					show: true,
					label: {
						formatter: function (params) {
							return DateMouv[parseInt(params.value)]; // 
						}
					},
				},
				data: Jours_X
			},
			yAxis: {
				axisLine: {
					lineStyle: {
						color: 'rgb(165,165,165)',
						width: 2
					}
				},
				axisTick: {
					length: 3,
				},
				axisLabel: { // Settings related to axis label
					color: 'rgb(070,070,070)',
					formatter: '{value}' // En mettant au format text, on enlève le formattage : 1,400 au lieu de 1400
				},
				splitLine: {
					lineStyle: {
						width: 1,
						type: "dotted"
					}
				},
				type: 'value',
				scale: true, // Permet d'avoir une échelle plus adaptée, tenant compte des min et max
//				min: 'dataMin', //WMin, // NON UTILISABLE AVEC scale
//				max: 'dataMax', //WMax, // NON UTILISABLE AVEC scale
				name: 'Mouvements',
				nameLocation: 'center',
				nameRotate: 90,
				nameTextStyle: {
					padding: 35, // Décalage par rapport à l'axe des Y
					fontWeight: 'bold',
					color: P_TextColor,
					fontSize: P_AxeTextSize
				},
				axisPointer: {
					show: true,
					label: {
						formatter: function (params) {
							return parseInt(params.value) + "";
						}
					}
				}
			},
			dataZoom: [{
				type: "slider",
				showDetail: true, // Permet d'afficher ou pas les valeurs sur le dataZoom
				showDataShadow: 'auto',
				realtime: true,
				rangeMode: "percent",
				start: WDebZoom, // the left is located at 10% - DEFAUT = 0
				end: WFinZoom, // the right is located at 60% - DEFAUT = 33
				filterMode: "empty",
				/**
				 * @param {*} value If axis.type is 'category', `value` is the index of axis.data.
				 *                  else `value` is current value.
				 * @param {strign} valueStr Inner formatted string.
				 * @return {string} Returns the label formatted.
				 */
				labelFormatter: function (value) {
					return DateMouv[value]; // Permet d'afficher la date complète en début et en fin de dataZoom
				}
			},
			{
				type: "inside",
				filterMode: 'empty'
			}],
			toolbox: { // Cartouche en haut à droite
				show: true,
				padding: [10, 15, 0, 0], // [haut, droit, bas, gauche]
				itemSize: 14,
				itemGap: 5,
				showTitle: true,
				feature: {
					restore: {
						show: true,
						title: 'Rechargement'
					},
					magicType: {
						type: ['line', 'bar'],
						title: {
							line: 'Ligne',
							bar: 'Histo.'
						}
					},
					saveAsImage: {
						title: 'Sauvegarde\nPNG'
					},
					dataView: {
						show: true, // Affiche ou non l'icône pour afficher les données utilisées.
						readOnly: false,
						backgroundColor: '#88ABD9',
						title: 'Export\nCSV',
						lang: ['Données utilisées pour le graphique...', 'Retour', 'Export CSV'],
						optionToContent: function (opt) {
							var axisData = opt.xAxis[0].data;
							var series = opt.series;
							var WTable01 = '<div id="ID_Table_Data">';
							WTable01 = WTable01 + '<table class="table-fill">';
							WTable01 = WTable01 + '<thead><tr>';
							WTable01 = WTable01 + '<th class="text-center" style="width:200px">Dates</th>'
							WTable01 = WTable01 + '<th class="text-center" style="width:20%">' + series[2].name + '</th>';
							WTable01 = WTable01 + '<th class="text-center" style="width:20%">' + series[1].name + '</th>';
							WTable01 = WTable01 + '<th class="text-center" style="width:20%">' + series[0].name + '</th>';
							WTable01 = WTable01 + '</tr></thead>';
							WTable01 = WTable01 + '<tbody class="table-hover">';
							for (var i = 0, l = axisData.length; i < l; i++) {
								WLigneCSV = WLigneCSV + DateMouv[i] + ";" + series[2].data[i] + ";";
								WLigneCSV = WLigneCSV + series[1].data[i] + ";" + series[0].data[i];
								WLigneCSV = WLigneCSV + "\n";
								WTable01 += '<tr>' +
									'<td class="text-center" >' + DateMouv[i] + '</td>' +
									'<td class="text-center" >' + series[2].data[i] + '</td>' +
									'<td class="text-center" >' + series[1].data[i] + '</td>' +
									'<td class="text-center" >' + series[0].data[i] + '</td>' +
									'</tr>';
							}
							WTable01 += '</div></tbody></table>';
							return WTable01;
						},
						contentToOption: function (opt) { // Va permetrtre de gérer l'exportation en CSV
							var NomCSV = "TraficJournalier_" + P_Annee;
							var Ext = ".CSV";
							var FicCSV = NomCSV + Ext;
							// Ecrire le contenu de la variable WLigneCSV dans un fichier
							download(FicCSV, WLigneCSV);
						}
					}
				}
			},
			tooltip: {
				show: true,
				trigger: 'axis', // Triggered by axes.
/* Formattage de la bulle d'aide pour avoir les chiffres sous la forme européenne -------------------------------------------*/
				formatter: function(data) {
					var html = [DateMouv[parseInt(data[0].name)]];
					var p;
					var nb = data.length;
					while (p = data[--nb]) {
						html.push(p.marker + p.seriesName + " : " + p.value)
					}
					return html.join("<br>");
				},
/*---------------------------------------------------------------------------------------------------------------------------*/
				axisPointer: {
					type: 'cross',
//					label: {
//						formatter: function (params) {
//							return DateMouv[parseInt(params.value)]; // 
//						},
//					},
					lineStyle: {
						width: 1 // Epaisseur de la ligne verticale
					}
				}
			},
			series: [{
				type: 'line',
				name: WAnneeN, // Series name used for displaying in tooltip and filtering with legend
				symbolSize: 7,
				showSymbol: false, // Whether to show symbol. It would be shown during tooltip hover
				lineStyle: {
					width: 2,
					type: 'solid' //'dotted' / 'dashed'
				},
				smooth: false, // Permet de lisser ou non les courbes
				data: NbMouvN_Y
			},
			{
				type: 'line',
				name: WAnneeN1, // Series name used for displaying in tooltip and filtering with legend
				symbolSize: 7,
				showSymbol: false, // Whether to show symbol. It would be shown during tooltip hover
				lineStyle: {
					width: 1,
					type: 'solid' //'dotted' / 'dashed'
				},
				smooth: false, // Permet de lisser ou non les courbes
				data: NbMouvN1_Y,
			},
			{
				type: 'line',
				name: WAnneeN2, // Series name used for displaying in tooltip and filtering with legend
				symbolSize: 7,
				showSymbol: false, // Whether to show symbol. It would be shown during tooltip hover
				lineStyle: {
					width: 1,
					type: 'solid' //'dotted' / 'dashed'
				},
				smooth: false, // Permet de lisser ou non les courbes
				data: NbMouvN2_Y
			}]
		};
 
		if (P_Plateforme == "LFPO") {
			TJ_Chart_C1.setOption(TJ_ChartOpt);
			var TJ_Chart_C1 = echarts.init(document.getElementById("lfpo_tj")); //
		}
		if (P_Plateforme == "LFPG") {
			TJ_Chart_C2.setOption(TJ_ChartOpt);
			var TJ_Chart_C2 = echarts.init(document.getElementById("lfpg_tj")); //
		}
		if (P_Plateforme == "LFPB") {
			TJ_Chart_C3.setOption(TJ_ChartOpt);
			var TJ_Chart_C3 = echarts.init(document.getElementById("lfpb_tj_left")); //
		}
		if (P_Plateforme == "LFOB") {
			TJ_Chart_C4.setOption(TJ_ChartOpt);
			var TJ_Chart_C4 = echarts.init(document.getElementById("lfob_tj_right")); //
		}
	}
//------------------------------------------------------------------------------------
function MinMax(P_NbMouv, P_Val, P_Type) {
	if (P_Type == "MAX") {
		if (P_Val <= P_NbMouv) {
			P_Val = P_NbMouv;
		} else {
			P_Val = P_Val;
		}
		return P_Val;
	}
	if (P_Type == "MIN") {
		if (P_Val >= P_NbMouv) {
			P_Val = P_NbMouv;
		} else {
			P_Val = P_Val;
		}
		return P_Val;
	}
}
//------------------------------------------------------------------------------------