Hi Freaks,
I am trying to make a gantt chart with data stored in a mysql database but I am having problems with the syntax.
I can create the chart ok by hard coding, and I can see the database query is returning the expected data, but I just can't quite figure the correct syntax to pass the data to jpgraph to get the result.
simplified code:
<?php require_once('connections/manager.php'); ?>
<?php
mysql_select_db($database_manager, $manager);
$query_project = "SELECT `task`, `dateStart`, `dateFinish`, `managerName` FROM `test`";
$project = mysql_query($query_project, $manager) or die(mysql_error());
$row_project = mysql_fetch_assoc($project);
$totalRows_project = mysql_num_rows($project);
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_gantt.php');
$graph = new GanttGraph(800);
$graph->title->Set("Project");
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->day->SetStyle(DAYSTYLE_SHORTDATE4);
$graph->scale->day->grid->Show();
$graph->scale->month->SetStyle(MONTHSTYLE_LONGNAME);
$graph->scale->week->SetFont(FF_FONT1);
$n=0;
do
{
$data[]=array(array($n,$row_project["task"],$row_project["dateStart"],$row_project["dateFinish"],$row_project["managerName"]));
++$n;
//echo "\$bar".$n." = new GanttBar(".$n.",\"".$row_project["task"]."\",\"".$row_project["dateStart"]."\",\"".$row_project["dateFinish"]."\",\"".$row_project["managerName"]."\")";
}while
($row_project=mysql_fetch_array($project));
$graph->Add(array($data)); // I figure this is where I'm going wrong?
$graph->Stroke();
mysql_free_result($project);
?>
This is giving me the following error:
Other variations bring up an error graphic saying no date value, so as I said I'm pretty sure it's a problem with passing the array to jpgraph...
There don't appear to be any forums at jpgraph, and other searching isn't giving me any joy so any pointers would be most welcome.