<script type="text/javascript">

Highcharts.chart('container_CO2', {
	
	chart: {
		type: '<?php echo $chart_type; ?>',
		zoomType: 'x',
        resetZoomButton: {
            position: {
                // align: 'right', // by default
                // verticalAlign: 'top', // by default
                x: -30,
                y: -37
            }
        },
		height:480,
		marginLeft: 50,
		marginRight: <?php echo $legend_margin_right; ?>,
		marginTop:40,
		marginBottom:50,
		spacingLeft:0,
		plotBorderColor: '#346691',
        plotBorderWidth: 2,
		borderWidth: 1
	},

    credits: {
        enabled: false
    },

	tooltip: {
		xDateFormat: '%d/%m - %H:%M',
		enabled: <?php echo $show_tooltip_status; ?>,
		valueSuffix: ' ppm'
	},
		
	title: {
		<?php echo $title_AQCM05_CO2_HighCharts;?>
	},

	xAxis: {
		startOnTick: true,
		endOnTick: true,
		tickColor:"#000000",
		tickLength:5,
		tickInterval: 1*3600*1000,
		gridLineColor:"#CFCFCF",
		gridLineWidth: 1,
        min: <?php echo 1000*$start;?>,
        max: <?php echo 1000*$stop;?>,
		type: 'datetime',
		dateTimeLabelFormats: { // don't display the dummy year
		month: '%e. %b',
		year: '%b'
		}
	},

	yAxis: 
	{ 
		offset: 0,
		min: 0,
        max: <?php echo $HC_CO2_max_scale;?>,
		tickInterval: <?php echo $HC_CO2_tickInterval;?>,
		minorTickInterval: <?php echo $HC_CO2_minorTickInterval; ?>,
		tickColor:"#000000",
		tickLength:5,
		tickWidth: 1,
		allowDecimals: false,
		showFirstLabel:true,
		showLastLabel: true,
		gridLineColor:"#C9C9CB",
		gridLineWidth: 1,
		gridLineDashStyle: 'Solid',
		minorTicks: true,
		minorGridLineColor:"#C9C9CB",
		minorGridLineDashStyle: 'Solid',
		minorGridLineWidth:1,
		labels:{
			align: 'right',
			x: -10,
			y: 5,
			style: { 
				color: "#000000",
				fontSize: "13px"
			}
        },
		title: {
			text: 'ppm',
			x:60,
			y:-18,
			align: 'high',
			style: { 
				color: "#000000",
				fontSize: "18px"
			},
			rotation: 0
		},
				
		plotBands: [{
		//color: '#BBD2E1',
		//color: '#d0d0d0',
		color: 'rgba(80, 130, 200, 0.2)',
		from: 0,
		to: 398
		}],

		
		plotLines: [
			{
				value: 400,
				zIndex:4,
				color: '#000000',
				dashStyle: 'solid',
				width: 1,
				label: {
					y: -6,
					text: ''
				}
			},
			{
				value: <?php echo $aqcm_CO2_TRIG_0; ?>,
				zIndex:3,
				color: '#16aa3e',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_CO2_TRIG_0; ?> ppm'
				}
			},
			{
				value: <?php echo $aqcm_CO2_TRIG_1; ?>,
				zIndex:3,
				color: '#069A2E',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_CO2_TRIG_1; ?> ppm'
				}
			},
			{
				value: <?php echo $aqcm_CO2_TRIG_2; ?>,
				zIndex:3,
				color: '#FFFF00',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_CO2_TRIG_2; ?> ppm'
				}
			},
			{
				value: <?php echo $aqcm_CO2_TRIG_3; ?>,
				zIndex:3,
				color: '#FFBF00',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_CO2_TRIG_3; ?> ppm'
				}
			},
			{
				value: <?php echo $aqcm_CO2_TRIG_4; ?>,
				zIndex:3,
				color: '#FF0000',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_CO2_TRIG_4; ?> ppm'
				}
			},
			{
				zIndex:3,
				value: <?php echo $aqcm_CO2_TRIG_5; ?>,
				color: '#780373',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_CO2_TRIG_5; ?> ppm'
				}
			}

		]
		
	},
			
	plotOptions: 
	{
		spline: 
		{
			marker: {
				enabled: false
			}
		},
		
       series: {
			animation: false,
            states: {
                hover: {
                    enabled: <?php echo $show_tooltip_status; ?>
                }
            }
        },
		
		areaspline: {
			fillColor: {
				linearGradient: {
					x1: 0,
					y1: 0,
					x2: 0,
					y2: 1
				},
				stops: [
					[0, "rgba(130, 180, 250, 1.0)"],
					[1, "rgba(130, 180, 250, 0.5)"],
				]
			},
			marker: {
				radius: 0
			},
			lineWidth: 1,
			states: {
				hover: {
					lineWidth: 1
				}
			},
			threshold: 403
		},		
		
		area: {
			fillColor: {
				linearGradient: {
					x1: 0,
					y1: 0,
					x2: 0,
					y2: 1
				},
				stops: [
					[0, "rgba(0, 0, 0, 1.0)"],
					[1, "rgba(0, 0, 0, 1.0)"],
				]
			},
			marker: {
				radius: 0
			},
			lineWidth: 1,
			states: {
				hover: {
					lineWidth: 1
				}
			},
			threshold: 0
		}		
		
	},

	legend: {
		enabled: <?php echo $show_mini_maxi; ?>,
		title: {
			text: '<span style="font-size: 9px; color: #666; font-weight: normal">(montrer/cacher)</span>',
			style: {
				fontStyle: 'italic'
			}
		},
		backgroundColor: 'white',
		floating: true,
		layout: 'vertical',
		align: 'right',
		verticalAlign: 'top',
		x: 5,
		y: 29
	},

<?php

	echo "
	series: 
	[
	"; 
			
	for ($i=($NB_sondes-1);$i>=0;$i--) {

		if ( $Flag_SONDE_OK[$i] ) {

			echo "
					{
						type: '" . $chart_type_min . "',
						name: '";echo "CO2_min";echo "', 
						visible: " . $min_max_visible . ",
						color: '" . $HC_couleur_courbes_min . "',
						lineWidth: " . $HC_lineWidth_min . ", 
						data: [ 
			"; 
								echo join($data_AQCM05[$i][2][0], ','); 
			echo "
							  ]
					},";
					
			echo "
					{
						type: '" . $chart_type_moy_thin . "',
						name: '";echo "CO2";echo "', 
						visible: true,
						color: '" . $HC_couleur_courbes_moy_thin . "',
						lineWidth: " . $HC_lineWidth_moy_thin . ", 
						data: [ 
			"; 
								echo join($data_AQCM05[$i][2][1], ','); 
			echo "
							  ]
					},";
					
			echo "
					{
						type: '" . $chart_type_max . "',
						name: '";echo "CO2_max";echo "', 
						visible: " . $min_max_visible . ",
						color: '" . $HC_couleur_courbes_max . "',
						lineWidth: " . $HC_lineWidth_max . ", 
						data: [ 
			"; 
								echo join($data_AQCM05[$i][2][2], ','); 
			echo "
							  ]
					},";

		}

		if ( $periode == "10_MN" ) {
			
			echo "
					{
						type: '" . $chart_type_column . "',
						step: true,
						borderWidth: 0,
						pointWidth: '" . $column_pointWidth . "',
						maxPointWidth: 12,
						name: '";echo "PRES";echo "', 
						visible: " . $p_show_presence . ",
						color: '#000000',
						data: [ 
			"; 
								echo join($data_AQCM05[$i][13][0], ','); 
			echo "
							  ]
					},";

			echo "
					{
						name: '";echo "CO2(PRES)";echo "', 
						type: '" . $chart_type_biquo . "',
						visible: " . $min_max_visible . ",
						color: '#000000',
						lineWidth: " . $HC_lineWidth_moy_thin . ", 
						data: [ 
			"; 
								echo join($data_AQCM05[$i][13][1], ','); 
			echo "
							  ]
					},";

		}

	}

	echo "
	]
	";

?>
	
});

</script>

