Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/11/2009, 12:26
Avatar de dcreate
dcreate
 
Fecha de Ingreso: octubre-2009
Ubicación: Veracruz
Mensajes: 536
Antigüedad: 14 años, 6 meses
Puntos: 22
problema con graficas

Hola amigos, sigo con mi problema de graficas con jpgraph, ya por fin la logre dibujar y todo, ahora lo q intento es q cuando pase el puntero por arriba de cada objeto muetre un valor, bueno aki esta una forma:

index.php

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Documento sin t&iacute;tulo</title>
</
head>

<
body>
<
form id="form1" name="form1" method="post" action="grafica.php">
  <
label>
  
VALOR 1:
  <
input name="valor1" type="text" id="valor1" />
  </
label>
  <
p>
    <
label>VALOR 2:
    <
input name="valor2" type="text" id="valor2" />
    </
label>
  </
p>
  <
p>VALOR 3
    <
label>
    <
input name="valor3" type="text" id="valor3" />
    </
label>
</
p>
  <
p>
    <
label>
    <
input type="submit" name="Submit" value="Enviar" />
    </
label>
  </
p>
</
form>
</
body>
</
html
grafica.php

Código PHP:
<?php 
$valor1
=$_POST['valor1'];
$valor2=$_POST['valor2'];
$valor3=$_POST['valor3'];
require_once (
"jpgraph/jpgraph.php"); 
require_once (
"jpgraph/jpgraph_line.php"); 
require_once (
"jpgraph/jpgraph_bar.php"); 

// content="text/plain; charset=utf-8" 

//$datay = array($valor1,$valor2,$valor3); 
$datay = array(12,56,34); 

$targ = array($valor1,$valor2,$valor3);
$alt = array($valor1,$valor2,$valor3); 

// Create the graph. 
$graph = new Graph(980,680);
$graph->SetMarginColor('white');
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->SetFrame(true);
$graph->img->SetMargin(80,30,80,40);
$graph->title->Set('GRAFICA');
$graph->ygrid->SetFill(true,'#[email protected]','#[email protected]');

// Create the linear plot 
$lineplot=new LinePlot($datay); 
$lineplot->SetCenter();
$lineplot->mark->SetType(MARK_FILLEDCIRCLE);
$lineplot->mark->SetWidth(5);
$lineplot->mark->SetColor('black');
$lineplot->mark->SetFillColor('red');
$lineplot->SetCSIMTargets($targ,$alt);

// Add the plots to the graph 
$graph->Add($lineplot);  

$graph->StrokeCSIM();

?>
bueno aki si me dibuja la grafica con el arreglo:

Código php:
Ver original
  1. $datay = array(12,56,34);

pero si lo cambio por esto

Código php:
Ver original
  1. $datay = array($valor1,$valor2,$valor3);

aparece error de q el array no contiene nada, alguien q me pueda ayudar, e estoy volviendo loco con esto