<script>

const P_title = '<?php echo( "  Pa      |  sonde : " . $aqcm_NAME . "  |  Patm  |  " . $time_start_string . "  |  moyennes =  " . $P_moyennes_string . " (Pa)  |" ); ?>' ;

var ctx_P = document.getElementById('Chart_P').getContext("2d");

chart_P = new Chart(ctx_P, {
	
	type: 'line',
  
	data: {
		
		datasets: [
			{
				label: 'MIN',
				order: 1,
				hidden: true,
				data: <?php echo $series_chart_js_P_min; ?>,               
				tension: 0.5,
				pointStyle: false,
				borderWidth: 1,
				borderColor: MIN_border_color,
				backgroundColor: MIN_backgroundColor, 
				fill: {
					value: <?php echo $FS_MIN_P_moy; ?>,
					above: MIN_backgroundColor,
					below: MIN_backgroundColor,
				},

			},
			{
				label: 'MOY',
				order: 2,
				hidden: false,
				data: <?php echo $series_chart_js_P_moy; ?>,               
				tension: 0.5,
				pointStyle: false,
				borderWidth: 1,
				borderColor: MOY_border_color,
				backgroundColor: MOY_backgroundColor,
				fill: 0,

			},
			{
				label: 'MAX',
				order: 3,
				hidden: true,
				data: <?php echo $series_chart_js_P_max; ?>,               
				tension: 0.5,
				pointStyle: false,
				borderWidth: 1,
				borderColor: MAX_border_color,
				backgroundColor: MAX_backgroundColor,
				fill: 1,

			}
			
		]
	},

	options: {
		
		animation: false,
		
		scales: {
			
			x: {
				
				type: 'time',
				
				min: <?php echo 1000*$start;?>,
				max: <?php echo 1000*$stop;?>,
				
				time: {
					unit: '<?php echo $time_unit; ?>',
					displayFormats: {
						minute : 'HH:mm',
						hour: 'HH:mm',
						hours: 'dd/MM  HH:mm',
						day:  'dd/MM  HH:mm'
					},
					tooltipFormat: 'DD T'
				},
				
				
				ticks: {
					
					stepSize: <?php echo $x_stepSize; ?>,
					color: TICKS_color,
					autoSkip: false,
					font: {
						size: TICKS_font_size_x,
						weight: 'normal', 
						family: 'Arial',  
						style: 'normal'  
					}
				},
				grid:{
					color: color_of_grids
				},
		
			},
			
			y: {
				
				min: <?php echo($FS_MIN_P_moy); ?>,
				max: <?php echo($FS_MAX_P_moy); ?>,
				ticks: {
					color: TICKS_color,
					labelOffset: 0,
					padding: OPTIONS_SCALES_Y_padding_array[OPTIONS_SCALES_Y_padding_index_P],
					autoSkip: true,
					font: {
						size: TICKS_font_size_y,
						weight: 'normal', 
						family: 'Arial',  
						style: 'normal'  
					}
				},
				grid:{
					color: color_of_grids
				},
				
			}
			
		},
		
		plugins: {
			
			legend: {
				position: 'right',
				labels: {
					boxWidth: LEGEND_box_width,
					color: LEGEND_box_color
				}
			},
		  
			title: {
				color: '#000000ff',
				display: true,    
				text: P_title, 
				position: 'top',   
				align: 'start',   
				fullSize: true,    
				font: {
					size: 20,       
					weight: 'normal', 
					family: 'Arial',  
					style: 'normal'  
				},
				padding: {
					top: 8,         
					bottom: 13,      
				}
			},
		  
			annotation: {
				annotations: {

				}

			},
		
			tooltip: {
				enabled: tooltip_enabled
			}

		}
		
	}
  
});

</script>

