scales11 Posted August 24, 2012 Share Posted August 24, 2012 Hi all. 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: <html> Before plot: <br> <?php $tempy=array(5,4,3,2,1); $tempx=array(1,2,3,4,5); include "temp3.php"; ?> <br> After </html> temp3.php: <?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=array(); $lp=new LinePlot($tempy,$tempx); $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'); ?> Jpgraph ends up showing me a huge error(25121): "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. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.