<?PHP
include ("conexion/SecurityAccess.php");
?>
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Highcharts Example</title>

		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
		<style type="text/css">
${demo.css}
		</style>
		<script type="text/javascript">
$(function () {
    $('#container').highcharts({
		
		credits: {
            enabled: false
        },
		
        title: {
            text: 'Los KPIS con mayor demanda',
            x: -20 //center
        },
        subtitle: {
            text: 'Top 10',
            x: -20
        },
        xAxis: {
            
				
			categories: [
			
			<?php
			$sql=mysql_query("SELECT COUNT( * ) AS TotEjecuciones, CVE_REPORTE As CveRep, (SELECT NOMBRE_REPORTE FROM dashboard_historico WHERE CVE_REPORTE = CveRep Limit 0,1 ) As NomRepFin FROM dashboard_historico GROUP BY CVE_REPORTE ORDER BY TotEjecuciones DESC Limit 0,10");
			while($res=mysql_fetch_array($sql)){
			?>
			
			['<?php echo "Rep. ".$res['CveRep'] ?>'],
			
			<?php
			}
			?>
			
			]
			
        },
        yAxis: {
            title: {
                text: 'Total de veces generado'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        tooltip: {
            valueSuffix: ' Veces'
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: [{
            name: 'Frecuencia de Generación',
            data: [
                
				<?php
			$sql=mysql_query("SELECT COUNT( * ) AS TotEjecuciones, CVE_REPORTE As CveRep, (SELECT NOMBRE_REPORTE FROM dashboard_historico WHERE CVE_REPORTE = CveRep Limit 0,1 ) As NomRepFin FROM dashboard_historico GROUP BY CVE_REPORTE ORDER BY TotEjecuciones DESC Limit 0,10");
			while($res=mysql_fetch_array($sql)){
			?>
			
                ['<?php echo $res['NomRepFin']." -> ".$res['TotEjecuciones']; ?>', <?php echo $res['TotEjecuciones'] ?>],
			
			<?php
			}
			?>
			
            ]
        }]
    });
});
		</script>
	</head>
	<body>
<script src="Highcharts-4.1.5/js/highcharts.js"></script>
<script src="Highcharts-4.1.5/js/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; max-width: 600px; height: 300px; margin: 0 auto"></div>

	</body>
</html>