Arrays and Graphs

Hi

I have been trying to create a graph using data taken from my database. The data is from 3 selected rows, each row has 4 columns. Here is the code:-

$query=mysql_query(“SELECT * FROM profilereport WHERE profilereport.profilereportid=$value”);

$_SESSION['rows']=array(); $_SESSION['row']=array();
		
	while ($row=mysql_fetch_row($query))
		{     
		   array_push($_SESSION['rows'], $row);  
		}
						
			foreach($_SESSION['rows'] as $row)
				{

				      for($x=0; $x<4; $x++)  //test echo results to screen
						{
					    
						echo $row[$x];
												
						}

				} 	

The graphing program I am using is JpGraph and trying to implement the following code and graph:-

Test suite for JpGraph - new_bar1.php

My question is, how do I take the data from my array and use it to create the graph?

Any help/suggections would be greatly appreciated

Thanks, Shane

While there are many ways to do this, for a simple graph you could use your array values to populate the with of a background image on a div. For instance to show the graph at the midpont width=“50%” would work, etc.

Is the row index your X-index, or your G-index?

(IE: Is one row all the entries for one color of bar on the graph, or the entries for “A” on your example page)

One row is all the entries for one color and then the second row would be the second color and the third row the third color etc.

so then


$bargroups = array()
while($row = $result->fetch_row()) {
  $bargroups[] = new BarPlot($row);
}
$gbplot = new GroupBarPlot($bargroups);

Great, worked after after some tweaking of the graph code.
Thankyou