Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/08/2012, 17:34
ANDRESDD
 
Fecha de Ingreso: julio-2012
Ubicación: Guatemala
Mensajes: 99
Antigüedad: 11 años, 10 meses
Puntos: 2
Respuesta: OPEN FLASH CHART problemas con variables

Muy bien, aqui esta el codigo del boton select, que sería el archivo A

<div align = center >
<table border="1" cellpadding="0" cellspacing="5">
<tr><td><label>Seleccionar</label></td></tr>
<tr><td><form action="grafcli.php" method="post">
<div align = "center"><br><select name="resc" witdth="150">
<?php require_once("conexion3.php"); while($arreglo = mysql_fetch_array($q)) { ?>
<option value="<?php echo $arreglo['em']?>"><?php echo $arreglo['em']?></option><?php }?>
</select>
</div>
</td>
</tr>

<table border="1" cellpadding="0" cellspacing="5">
<tr><td><input type="submit" value="Enviar" name = "enviar">
</td></tr>
</table>
</form>
</div>


este es el archivo JSON, que equivale al archivo B

<html>
<head>

<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">

swfobject.embedSWF(
"open-flash-chart.swf", "my_chart",
"750", "300", "9.0.0", "expressInstall.swf",
{"data-file":"grafcli.php"} );

</script>
<head>


</html>



y este es el archivo de las instrucciones para graficar que sería el C o (grafcli.php)
y de donde parcialmente tengo apuntado enviar la variable desde el select

(todo funciona muy bien si en vez de poner la siguiente consulta pongo definida la variable como $FN ='1'; pero obviamente necesito que no tome un valor único.

require_once("conexion2.php");

$registro=mysql_query("select id from comrs where emp='$_POST[resc]'");
$reg=mysql_fetch_array($registro);

$FN=$reg['id'];


$query="SELECT ".$A.",".$B.",".$C." ,".$D." ,".$E." ,".$F." ,".$G." ,".$H." ,".$I.",".$J.",".$K." FROM porc WHERE id=".$FN." ";
$q=mysql_query($query, $conexion);

$data = array();

while($arreglo = mysql_fetch_array($q))

{
$data[] = (int) $arreglo[$A];
$data[] = (int) $arreglo[$B];
$data[] = (int) $arreglo[$C];
$data[] = (int) $arreglo[$D];
$data[] = (int) $arreglo[$E];
$data[] = (int) $arreglo[$F];
$data[] = (int) $arreglo[$G];
$data[] = (int) $arreglo[$H];
$data[] = (int) $arreglo[$I];
$data[] = (int) $arreglo[$J];
}



require_once('php-ofc-library/open-flash-chart.php');

//TITULO
$title = new title( date("D M d Y") );
$title->set_style( "{font-size: 15px; font-weight: bold; color:#ff0000; text-align: center;}" );

//BARRAS

$bar = new bar_3d();
$bar->set_values( $data );
$bar->colour = '#d3d3d3';


$x_labels = array('Calidad','Servicio al cliente','Precio justo','Actitud falsa','Cumplimiento','Efectividad','Eficiencia',' Ridiculos','Interesados','Anuncios estupidos');


//EJE X

$x_color='#d3d3d3';

$x_axis = new x_axis();
$x_axis->set_3d( 5 );
$x_axis->colour = '#ff0000';
$x_axis->set_labels_from_array( $x_labels );
$x_axis->set_grid_colour( $x_color);


//EJE Y

$y_color='#d3d3d3';

$y_axis = new y_axis();
$y_axis->set_range( 0,100,10);
$y_axis->colour = '#000000';
$y_axis->set_grid_colour( $y_color);


//EJECUCION

$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $bar );
$chart->set_x_axis( $x_axis );
$chart->set_y_axis( $y_axis );
$chart->set_bg_colour( '#C0C0C0' );


//LEYENDA EJE Y
$y_legend = new y_legend( 'Porcentaje %' );
$y_legend->set_style( '{font-size: 20px; font-weight: bold; color: #ff0000;}' );
$chart->set_y_legend( $y_legend );

echo $chart->toString();


?>