Good morning guys
Just wondered if any of you knew why this code isn't giving me any output
<?php
// VectorPlotNoFile.php - Creating a graph with more than one line plot using data inside the script
//---------------------
// Include the necessary class files for the graph
include ("../jpgraph/src/jpgraph.php");
include ("../jpgraph/src/jpgraph_line.php");
// Create the graph. These two calls are always required
$graph = new Graph(300,200,"auto"); // Creates a graph 300px x 200px with an automatic cache name
$graph->SetScale("linlin"); // Set the scales on both axes to linear
// Open a file and read it line-by-line
$handle = @fopen("VectorData.txt", "r");
if ($handle) { // If file exists then continue
$i = 1;
while (!feof($handle)) {
$ydataName = "ydata" . $i; // Create a numbered variable
$$ydataName = explode(", ", str_replace("\r\n", "", fgets($handle, 4096))); // Format the data appropriately
$xdataName = "xdata" . $i;
$$xdataName = explode(", ", str_replace("\r\n", "", fgets($handle, 4096)));
$dataNameCount = $i; // Keep count of the numbers
$i++;
}
fclose($handle);
}
$j = 1;
while ($j <= $dataNameCount) {
$ydataName = "ydata" . $j;
$xdataName = "xdata" . $j;
$lineplotName = "lineplot" . $j;
$$lineplotName=new Lineplot($$ydataName, $$xdataName);
$graph->Add($$lineplotName);
$j++;
}
// Format the graph appropriately
$graph->img->SetMargin(40,20,20,40);
$graph->title->Set("Example 4");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$lineplot->SetColor("blue");
$lineplot->SetWeight(2);
$lineplot2->SetColor("orange");
$lineplot2->SetWeight(2);
$graph->yaxis->SetColor("red");
$graph->yaxis->SetWeight(2);
$graph->SetShadow();
// Display the graph
$graph->Stroke();
?>
Thank you, please
Rob