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

hola, por fin pude solucionar mi problema y por si acaso alguien se atora alguna vez en esto aki les dejo la solucion

este es index.php
Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Documento sin título</title>
  6. </head>
  7.  
  8. <body>
  9. <form id="form1" name="form1" method="post" action="barcsim_popup.php">
  10. <?php
  11. for($i=0;$i<5;$i++)
  12. {
  13. $d=$i+1;
  14. echo 'CAMPO '. $d .': <input name="c'.$i.'" type="text" /><br><br>';
  15. }
  16. ?>  
  17. <input name="enviar" type="submit" value="ENVIAR"/>
  18. </form>
  19. <p>&nbsp;</p>
  20. </body>
  21. </html>

y este es barcsim_popup.php
Código PHP:
Ver original
  1. <?php
  2. $a=$_REQUEST['c0'];
  3. $b=$_REQUEST['c1'];
  4. $c=$_REQUEST['c2'];
  5. $d=$_REQUEST['c3'];
  6. $e=$_REQUEST['c4'];
  7. // content="text/plain; charset=utf-8"
  8. include_once ("jpgraph.php");
  9. include_once ("jpgraph_line.php");
  10.  
  11. // Some random data to plot
  12. $datay=array($a,$b,$c,$d,$e);
  13.  
  14. // Create the graph.
  15. $graph = new Graph(600,400);
  16. $graph->SetScale("textlin");
  17.  
  18. // Create a bar pot
  19. //$bplot = new BarPlot($datay);
  20. $bplot = new LinePlot($datay);
  21. $bplot->SetColor("red");
  22. $bplot->SetWeight(2);
  23. $bplot->SetCenter();
  24. $bplot->mark->SetType(MARK_FILLEDCIRCLE);
  25. $bplot->mark->SetFillColor("red");
  26. $bplot->mark->SetWidth(3);
  27.  
  28. // Create targets for the image maps so that the details are opened in a separate window
  29. $fmtStr = "javascript:window.open('new.php?id=%d&val=%s','_new','width=500,height=300');void(0)";
  30. $n = count($datay);
  31. $targ=array();
  32. $alts=array();
  33. for($i=0; $i < $n; ++$i) {
  34.     $targ[$i] = sprintf($fmtStr,$i+1,$datay[$i]);
  35.     $alts[$i] = 'val=%d';
  36.     // Note: The format placeholder val=%d will be replaced by the actual value in the ouput HTML by the
  37.     // library so that when the user hoovers the mouse over the bar the actual numerical value of the bar
  38.     // will be dísplayed
  39. }
  40. $bplot->SetCSIMTargets($targ,$alts);
  41.  
  42. // Add plot to graph
  43. $graph->Add($bplot);
  44.  
  45. // Setup the title, also wih a CSIM area
  46. $graph->title->Set("CSIM with popup windows");
  47. $graph->title->SetFont(FF_FONT2,FS_BOLD);
  48. // Assume we can give more details on the graph
  49. $graph->title->SetCSIMTarget(sprintf($fmtStr,-1,0),'Title for Bar');
  50.  
  51. // Send back the HTML page which will call this script again to retrieve the image.
  52. $graph->StrokeCSIM();
  53.  
  54. ?>

lo solucione, aunk la respuesta es un poco absurda y me dejo perplejo, antes recuperaba los valores por $_POST y no generaba la grafica; la solucion fue recuperar los valores con $_REQUEST y listo, espero les sirva, esto tardo en solucionar casi 5 meses