<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PLChart Demo</title>
</head>
<script type="text/javascript">
function moveCar() { 
	document.getElementById('ix').src='grafico.php?ran='+Math.random();
}

</script>
<?php

function apc_fetch_udt($key){	
	$udtl_store = apc_fetch("udt".$key);
	$udt = time();
	if ($udtl_store){
		if ($udt-$udtl_store<9) { // 5 segundos maximo de vida
			$val = apc_fetch($key);
			apc_store('dif', ($udt-$udtl_store));
			return $val; 
		} else {
			// no vamos a borrar, es mejor que los datos esten obsoleto a que no este y se caiga.
			/*apc_delete($key);
			apc_delete("udt".$key);*/
			
			return false;
		}
	} else {
		return false;
	}
}
function apc_store_udt($key,$g){
	$udt = time();
	apc_store($key, $g);
	apc_store("udt".$key, $udt);
} 



$eje=array();
$valores=array();
for ($i=0;$i<12;$i++) {
	$eje[$i]=$i*2;
	$valores["2000"][$i]=rand(0,100);
	$valores["2001"][$i]=rand(0,100);
	$valores["2002"][$i]=rand(0,100);
	$valores["2003"][$i]=rand(0,100);
}
$data=array($eje);
$data["2000"]=$valores["2000"];
$data["2001"]=$valores["2001"];
$data["2002"]=$valores["2002"];
$data["2003"]=$valores["2003"];



echo var_dump($data)."<br>";
/*

$data = array(
              array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12),
			  "2000" => array(13, 15, 19, 17, 24, 27, 27, 29, 32, 24, 22, 25),
			  "2001" => array(23, 24, 26, 25, 19, 16, 19, 16, 27, 24, 19, 20),
			  "2002" => array(16, 18, 18, 21, 16, 14, 18, 28, 15, 19, 23, 22),
			  "2003" => array(14, 16, 12, 23, 17, 22, 21, 28, 25, 26, 23, 27)
			 );

			 echo var_dump($data)."<br>";
*/

echo var_dump(array_keys($data));

apc_store_udt("datos_graficos",$data);



?>



<body onLoad="javascript:setInterval('moveCar()', 3000)">  

<!--
<p><img src="demo_pie_2d.php"></p>
<p><img src="demo_pie_3d.php"></p>
<p><img src="demo_column_2d.php"></p>
<p><img src="demo_column_3d.php"></p>
<p><img src="demo_groupcolumn_2d.php"></p>
<p><img src="demo_groupcolumn_3d.php"></p>
<p><img src="demo_line_single.php"></p>
<p><img src="demo_line_multi.php"></p>
-->
<p><img src="grafico.php" id='ix'></p>

sasasasa

<img src="demo_column_2d.php" id="rollfirst"
     onmouseover="document.getElementById('ix').src='demo_line_multi.php?ran='+Math.random()"
     onmouseout="document.getElementById('ix').src='demo_line_multi.php?ran='+Math.random()">


</body>
</html>
