|      Unas dudas        Claudio disculpame que te moleste ,tengo unas dudas , en el ejemplo que pongo mas abajo de un crear_grafica.php ¿donde tengo que colocar el codigo que tu me dices en tu post anterior, para que me muestre los ultimos 10 dias?   
<? 
include ("jpgraph.php"); 
include ("jpgraph_line.php"); 
require ("../Connections/servidor.php");   
//se reciben por parámetro los valores de: moneda, contra, período de fecha,  
// se selecciona eso de la base y se carga con los resultados el array para los valores 
   $rsConsulta=mysql_query("SELECT DATE_FORMAT(Fecha,'%e.%m.%y') AS Fecha,  
   Compra, Venta, (Compra+Venta)/2 AS Media  
   FROM cotizaciones C  
   WHERE Moneda = '" . str_replace("'", "''", $moneda) . "'  
   AND Contra = '" . str_replace("'", "''", $contra) . "'   
   AND Fecha BETWEEN '" . str_replace("'", "''", $desde) . "'  
   AND '" . str_replace("'", "''", $hasta) . "'  
   ORDER BY C.Fecha", $miweb)   
   or DIE(mysql_error());     
//Determino cuantas fechas tengo, para mostrar la cantidad adecuada, solamente entran 10  
// fechas por gráfica con el tamaño de 550 x 300 elejido. 
// Solo recupero la parte entera, si tiene decimles, le sumo 1. 
$registros = mysql_num_rows($rsConsulta); 
$intervalo = $registros/9; 
$cadaX = intval($intervalo); 
$tmpcadaX = $intervalo - $cadaX;   
if ($tmpcadaX > 0)  
	$cadaX++;     
//Cargo el arreglo con los valores 
$i=0; 
//La inicializo al valor de cadaX para que se muestre la primera también 
$cadaActual=$cadaX;   
while($row = mysql_fetch_row($rsConsulta)) { 
	if ($cadaActual = $cadaX) { 
		$fechas[$i] =$row[0]; 
		$cadaActual=0; 
	} 
	$compras[$i] =$row[1]; 
	$ventas[$i] =$row[2]; 
	$medias[$i] =$row[3]; 
	$i++; 
	$cadaActual++; 
}   
//now we expand it 
//while(list($compra, $venta) = each($myArray)) { 
//echo "$compra : $venta"; 
//}    
//libero los recursos utilizados por el recordset y la base. 
mysql_free_result($rsConsulta); 
mysql_close($miweb);   
$grafoCompra = $compras; 
$grafoVenta = $ventas; 
$grafoMedia =$medias;   
// Create the graph. These two calls are always required 
$graph = new Graph(550,300);	 
$graph->SetScale("textlin");   
//habilito el anti-aliasing, para que se dibujen mejor las líneas. 
//es un poco mas lento pero el resultado final lo justifica 
$graph->img->SetAntiAliasing();   
// Increase the margins (left,right,top,bottom) 
$graph->img->SetMargin(50,30,30,40);   
// Add graph and axis title 
$graph->title->Set("Gráfico de cotizaciones"); 
//$graph->subtitle->Set("miservidor.com"); 
$graph->xaxis->title->Set("Fecha"); 
//$graph->yaxis->title->Set("Cotización"); 
//Pongo el título del eje de las y manualmente ya que sinó se encima con los valores  
//$graph->yaxis->title->Pos(0.01,0.5,"centered"); 
$txt1=new Text("Cotización"); 
$txt1->Pos(0.02,0.35,"center"); 
$txt1->SetOrientation("v"); 
$txt1->SetFont(FF_FONT1,FS_BOLD); 
$graph->AddText($txt1);     
//Indico que se muestre la leyenda del eje de las X una cada tantas indicada en la variable 
$graph->xaxis->SetTextTickInterval($cadaX);   
//Le pongo una sombra a toda la gráfica 
$graph->SetShadow();   
//$graph->SetMarginColor("lemonchiffon2"); 
$graph->SetMarginColor("lightskyblue2");   
//Pongo la fuente para los títulos 
//$graph->title->SetFont(FF_VERDANA,FS_BOLD,14); 
$graph->title->SetFont(FF_FONT1,FS_BOLD); 
$graph->title->SetColor("darkgreen"); 
//$graph->subtitle->SetFont(FF_VERDANA,FS_ITALIC,7);   
//$graph->yaxis->title->SetFont(FF_VERDANA,FS_NORMAL,9); 
//$graph->yaxis->SetFont(FF_ARIAL, FS_NORMAL,8); 
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); 
$graph->yaxis->SetFont(FF_FONT0,FS_NORMAL);   
//$graph->xaxis->title->SetFont(FF_VERDANA); 
//$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL,7); 
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); 
$graph->xaxis->SetFont(FF_FONT0, FS_NORMAL);   
//$graph->legend->SetFont(FF_VERDANA, FS_NORMAL,8);   
// Create the linear plot 
$lineCompra=new LinePlot($grafoCompra); 
$lineVenta=new LinePlot($grafoVenta); 
$lineMedia=new LinePlot($grafoMedia);   
//Cambio el color y grosor de la línea  
//luego pongo el punto de la marca de un tipo, para la intersección de un valor x con un y. 
// Si está con antialasing, no le hace caso al setweight. 
$lineCompra->SetColor("blue"); 
$lineCompra->SetWeight(1);   
//$lineCompra->mark->SetType(MARK_DIAMOND);   
//Para la otra línea tambien 
$lineVenta->SetColor("orange"); 
$lineVenta->SetWeight(2); 
//$lineVenta->mark->SetType(MARK_SQUARE);   
$lineMedia->SetColor("brown"); 
$lineMedia->SetWeight(1.5); 
//$lineMedia->mark->SetType(MARK_CROSS);   
//Se muestran las líneas verticales 
$graph->xgrid->Show(true,false);   
// adiciono las fechas en el eje de las x, con un ángulo dado 
$graph->xaxis->SetTickLabels($fechas); 
//$graph->xaxis->SetLabelAngle(60);   
//ubico la leyenda 
$graph->legend->Pos(0.5,0.90,"center","center");   
//Pongo las leyendas de las líneas. 
$lineCompra->SetLegend("Compra"); 
$lineVenta->SetLegend("Venta"); 
//$lineMedia->SetLegend("Media");     
//Controlo que si son muchos registos no se muestran los valores de cada punto 
//if ($registros < 20){ 
	//$lineCompra->value->Show(); 
	//$lineVenta->value->Show(); 
	//$lineMedia->value->Show(); 
//}     
//Mensaje de copyrigth 
$txt=new Text("Derechos Reservados"); 
$txt->Pos(0.01,0.93,"centered"); 
$txt->SetColor("darkgreen"); 
$txt->SetFont(FF_FONT0); 
$graph->AddText($var);     
//Evito que se muestre el primer valor de la vertical. 
$graph->yaxis->scale->ticks->SupressFirst();   
// Add the plot to the graph 
//$graph->Add($lineCompra); 
//$graph->Add($lineVenta); 
$graph->Add($lineMedia);   
// Display the graph 
$graph->Stroke(); 
?>     
¿Como llamo a la grafica ? si antes era asi:./grafica/crear_grafica.php?nombre=fiat&contra=DLR&desde=200 6/05/21&hasta=2006/06/01   
Como seria el link para la grafica para que siempre me muestra los ultimos 10 días?   
Saludos y gracias           |