graficas dinamicas con php/swf chart
hola a todos tengo un proyecto y requiero mostrar informacion que tengo almacenada en bases de datos para realizar analisis comparativos de las mismas. encontre el php/swf chart para realizar este tipo de graficas pero no he logrado hacerlo funcionar alguien sabe como se hace. mi servidor el windows y las bases de datos estan en mysql.
el grafico que me genera tiene el grafico de jemplo y al lado los nuevos datos el script que estoy usando es el siguiente
<HTML>
<BODY bgcolor="#FFFFFF">
<?php
//include charts.php to access the InsertChart function
include "charts.php";
echo InsertChart ( "charts.swf", "charts_library", "sample.php", 400, 250 );
//start the PHP multi-dimensional array and create the region titles
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "REGION A";
$chart [ 'chart_data' ][ 2 ][ 0 ] = "REGION B";
$chart [ 'chart_data' ][ 3 ][ 0 ] = "REGION C";
//connect to the database
mysql_connect ( "localhost", "root", "" );
mysql_select_db ( "Accounting" );
//get the smallest year to determine which year to start the chart with
$result = mysql_query ( "SELECT MIN(Year) AS MinYear FROM Growth" );
$MinYear = mysql_result ( $result, 0, "MinYear" );
//get all the data in the Growth table
$result = mysql_query ("SELECT * FROM Growth");
//extract the data from the query result one row at a time
for ( $i=0; $i < mysql_num_rows($result); $i++ ) {
//determine which row in the PHP array the current data belongs to
switch ( mysql_result ( $result, $i, "Region" ) ) {
case "Region A":
$row = 1;
break;
case "Region B":
$row = 2;
break;
case "Region C":
$row = 3;
break;
}
//determine which column in the PHP array the current data belongs to
$col = mysql_result ( $result, $i, "Year") - $MinYear + 1;
//populate the PHP array with the Year title
$chart [ 'chart_data' ][ 0 ][ $col ] = mysql_result ( $result, $i, "Year");
//populate the PHP array with the revenue data
$chart [ 'chart_data' ][ $row ][ $col ] = mysql_result ( $result, $i, "Revenue");
}
//send the new data to charts.swf
SendChartData ( $chart );
?>
es el mismo grafico de ejemplo que hay en la pagina pero no logro hacerlo funcionar.
si alguien sabe como se usa este soft o que es loq ue estoy haciendo mal agradeceria la ayuda ya que es urgente que termine este proyecto
gracias
emerson
|