building graph with swf flash

Reply

Join Date: Feb 2008
Posts: 3
Reputation: irfani is an unknown quantity at this point 
Solved Threads: 0
irfani irfani is offline Offline
Newbie Poster

building graph with swf flash

 
0
  #1
Mar 1st, 2008
i try to building graph with charts swf (flash)
from query table i have 2 field like year,num,

i want result from script like this
$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 0 ][ 1 ] = "2001";
$chart [ 'chart_data' ][ 0 ][ 2 ] = "2002";
$chart [ 'chart_data' ][ 0 ][ 3 ] = "2003";
$chart [ 'chart_data' ][ 0 ][ 4 ] = "2004";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Drop Call";
$chart [ 'chart_data' ][ 1 ][ 1 ] = 5;
$chart [ 'chart_data' ][ 1 ][ 2 ] = 10;
$chart [ 'chart_data' ][ 1 ][ 3 ] = 30;
$chart [ 'chart_data' ][ 1 ][ 4 ] = 63;

=====

i try to make script like this



$chart [ 'chart_data' ][ 0 ][ 0 ] = "";
$chart [ 'chart_data' ][ 1 ][ 0 ] = "Drop Call";
$bar=1;
while($row = mysql_fetch_array($resultmoto))
{
$data[] = $row[1];
$leg[] = $row[0];
$chart [ 'chart_data' ][ 0 ][ $bar ] = $data;

$chart [ 'chart_data' ][ $row ][ $bar ] = $leg,
$bar++;
}


but the result still cannot display.
please check

tx
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: building graph with swf flash

 
0
  #2
Mar 1st, 2008
try changing your code like this:

  1. while($row = mysql_fetch_array($resultmoto))
  2. {
  3. $data = $row[1];
  4. $leg = $row[0];
  5. $chart [ 'chart_data' ][ 0 ][ $bar ] = $data;
  6.  
  7. $chart [ 'chart_data' ][ $row ][ $bar ] = $leg;
  8. $bar++;
  9. }

changes: made 'data' and 'leg' flat variables instead of arrays, changed comma to semicolon toward end of loop.

$row[0] and $row[1] are going to be the first and second columns in your table respectively...make sure that is the data you want to pull, otherwise call the columns by their associative name, such as $row['column_name'].
The End
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC