<script type="text/javascript">

Highcharts.chart('container_COV_IAQ', {
	
	chart: {
		type: 'spline',
		zoomType: 'x',
        resetZoomButton: {
            position: {
                // align: 'right', // by default
                // verticalAlign: 'top', // by default
                x: -30,
                y: -37
            }
        },
		height:"25%",
		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: '/500'
	},
	
	title: { <?php echo $title_COV_IAQ_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: 500,
		tickInterval: 50,
		tickColor:"#000000",
		tickLength:5,
		allowDecimals: false,
        showFirstLabel:true,
		showLastLabel: true,
		tickWidth: 1,
		gridLineColor:"#CFCFCF",
		gridLineWidth: 1,
		labels:{
			align: 'right',
			x: -10,
			y: 5,
			style: { 
				color: "#000000",
				fontSize: "13px"
			}
        },
		title: {
			text: '',
			x:60,
			y:-18,
			align: 'high',
			style: { 
				color: "#000000",
				fontSize: "18px"
			},
			rotation: 0
		},

		plotLines: [
			{
				value: <?php echo $aqcm_COV_TRIG_0; ?>,
				zIndex:4,
				color: '#28ED5D',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_COV_TRIG_0; ?> '
				}
			},
			{
				value: <?php echo $aqcm_COV_TRIG_1; ?>,
				zIndex:4,
				color: '#069A2E',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_COV_TRIG_1; ?> '
				}
			},
			{
				value: <?php echo $aqcm_COV_TRIG_2; ?>,
				zIndex:4,
				color: '#FFFF00',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_COV_TRIG_2; ?> '
				}
			},
			{
				value: <?php echo $aqcm_COV_TRIG_3; ?>,
				zIndex:4,
				color: '#FFBF00',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_COV_TRIG_3; ?> '
				}
			},
			{
				value: <?php echo $aqcm_COV_TRIG_4; ?>,
				zIndex:4,
				color: '#FF0000',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_COV_TRIG_4; ?> '
				}
			},
			{
				value: <?php echo $aqcm_COV_TRIG_5; ?>,
				zIndex:4,
				color: '#780373',
				dashStyle: 'solid',
				width: 2,
				label: {
					y: -6,
					text: '<?php echo $aqcm_COV_TRIG_5; ?> '
				}
			}

		]
		
	},
			
	plotOptions: 
	{
		spline: 
		{
			marker: {
				enabled: false
			}
		},
        series: {
			animation: false,
            states: {
                hover: {
                    enabled: <?php echo $show_tooltip_status; ?>
                }
            }
        }
	},

	legend: {
		enabled: <?php echo $legend_status;?>,
		itemStyle: {"color": "#333333", "cursor": "pointer", "fontSize": "12px", "fontWeight": "bold", "textOverflow": "ellipsis"},
		backgroundColor: 'white',
		floating: true,
		layout: 'vertical',
		align: 'right',
		verticalAlign: 'top',
		x: +4,
		y: +20
	},

<?php 
echo "
	series: 
	[
"; 
	
for ( $i = 0; $i < $NB_sondes; $i++ ) {
$index_couleur = $i % $NB_couleurs;
if ($Flag_SONDE_OK[$i]) {

echo "
		{
			type: 'spline',
			name: '";echo $nom_sonde[$i];echo "', 
			visible: true,
			color: '" . $couleur_courbes[$index_couleur] . "',
			lineWidth: " . $HC_lineWidth . ", 
			data: [ 
"; 
					echo join($data_AQCM05[$i][5], ','); 
if ($i == $NB_sondes-1) {
	echo "
					  ]
			}";
} else {
	echo "
					  ]
			},";
}

}

}

echo "
	]
";


?>
	
});

</script>

