I am having a simple problem with jpgraph. I have two files and I would like to pass a variable from one file to another(a jpgraph script with CSIM) so that it can be used to plot a chart. Below are my two files:
main.php
Code: Select all
<html>
Before plot:
<br>
<?php
$datay=array(5,4,3,2,1);
$datax=array(1,2,3,4,5);
include "temp3.php";
?>
<br>
After
</html>
Code: Select all
<?php
include ('/lib/jpgraph/jpgraph.php');
include ('/lib/jpgraph/jpgraph_line.php');
include ('/lib/jpgraph/jpgraph_date.php');
// Create the graph
$graph = new Graph(700,500);
$graph->SetScale('datlin');
// Create the linear plots
$lp=new LinePlot($datay,$datax);
$lp->SetColor('blue');
$lp->mark->SetType(MARK_FILLEDCIRCLE);
$lp->mark->SetFillColor('red');
//print_r($lp);
// Add the plot to the graph
$graph->Add($lp);
// Display the graph
$graph->StrokeCSIM('temp3.php');
?>
"empty input data array specified for plot. Must have at least one data point."
I know that the data is getting through somehow, because if I change the length of $tempx to an array of 6 numbers, then jpgraph complains that both arrays are not of equal size..WEIRD?!
Can anyone help me out? I don't even need to pass an array, I can also make it work if I am just able to pass a single variable (since I want to get the data from a specific database and I could just pass the table name).
Thanks.

