Jump to content

scales11

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

scales11's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well that is probably a better question. As I mentioned I am still new to PHP so there may be a better way to accomplish this. I have a table of data (in a sql server database) that I will be storing my x and y data in, for several plots. I decided that rather than create a bunch of .php files to make the plots, I would have a generic plot that I would call and pass the data (along with other parameters such as scale values, labels, and titles) to. This is the reason why I was trying to use the ?include? statement rather than calling a different php file each time I wanted to view a plot (with data). I also will be using the CSIM type of plot so that I can make the data clickable in order to launch other commands based on specific data points, ie. Changing and commenting them. In order to do this, I will have to use the ?include? statement (or so I thought). I am able to get the CSIM and image-mapping correct, provided that I do not pass any variables to the plot, meaning that I will need several plots and will be ?including? different ones based upon what is desired. Does that make sense?
  2. OK. Can you give me an example of the conditional logic? Then I can look up more and try and make it work.
  3. Well thank you very much for taking the time to help me figure out what is going on. I am still a bit of a newb to php but I think I understand some. So, I have another problem/question then. If I replace StrokeCSIM('plot.php'); with Stroke();, I get a broken image. Does your explanation hold true for that scenario as well?
  4. Ok, I just setup a fresh server. I installed jpgraph v3.5.0b1, and used the following two files: <?php // plot.php require_once ('./jpgraph/jpgraph.php'); require_once ('./jpgraph/jpgraph_line.php'); require_once ('./jpgraph/jpgraph_date.php'); $graph = new Graph(500,400,'auto'); $graph->SetScale('lin'); $sp1 = new LinePlot($datay,$datax); // Add the plot $graph->Add($sp1); $graph->StrokeCSIM('plot.php'); ?> <html> before <br> <?php // main.php $datay = array(2,3,2,3,4); $datax = array(1,2,3,4,5); include "./plot.php"; ?> <br> after </html> I am still getting the same result...
  5. Ahh, you are somewhat correct in this case...I mis-typed the proper label in the header (I titled it temp4.php when it should have been temp3.php) Unfortunately, this was the only place I mis-typed the file name and I actually have the file named temp3.php and it is the only one of its name in the folder. I was not however, using the "./" before the include. I shall give that a try and double check my variables as you suggest to see if I made a mistake. I shall report back.
  6. I have never used jpgraph. You could try to create your own. You are missing the point of the example I am showing. Initially (attempt 1) I did have the same amount of data in the x and y arrays. I only changed one to be larger so that I could show that the data was getting sent to jpgraph.
  7. close...but that is jgraph...not jpgraph
  8. Unfortunately, I cannot find any support for jpgraph other than the howto and documentation.
  9. Here is some example results: first attempt:(this is what I want to get working) second attempt: third attempt:
  10. 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.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.