I'm trying to make a graph that shows the average speed, for some dataplots. I have this code:

<?
include("include/jpgraph/jpgraph.php");
include("include/jpgraph/jpgraph_bar.php");

$datay=array(26,22,32);

// Create the graph. These two calls are always required
$graph = new Graph(300,200,"auto");	
$graph->SetScale("textlin");

// Add a drop shadow
$graph->SetShadow();

// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(40,30,30,40);

// Create a bar pot
$bplot = new BarPlot($datay);
$graph->Add($bplot);

// Setup the titles
$graph->title->Set("Average speed");
$graph->xaxis->title->Set("Date");
$graph->yaxis->title->Set("Average km/h");

$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

// Display the graph
$graph->Stroke();
?>

At the x-axis it shows the numbers 1-3. Instead I want to print my dates eg. "06/02-06", "08/02-06" and "11/02-06".
Can you tell me how to do this?

    $graph->xaxis->SetTickLabels(date);
    

    Date being your variable for date of course :rolleyes:

      I'm trying with this code:

      $graph->title->SetFont(FF_FONT1,FS_BOLD);
      $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
      $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
      $graph->xaxis->SetTickLabels("06/02-06, "08/02-06", "11/02-06"); 

      But it's returning this:
      Parse error: parse error, unexpected T_LNUMBER in graph.php on line 29

        Look at your syntax highlighting; you're missing some quotes.

          My code is:

          $graph->xaxis->SetTickLabels("06/02-06", "08/02-06", "11/02-06");

          Now I get this error:
          Unknown color: 0

            Write a Reply...