Jump to content

kimjessen

Members
  • Posts

    26
  • Joined

  • Last visited

kimjessen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello excuse my late reply, been busy. Well, better late than never. It works perfectly, and here now the file I work with is and corrupted. after a little adjustment so does the file perfectly. Many thanks for the help.
  2. Hi It is very odd! I just tried it on another server, my web hotel at one.com And yes there it works. The server I otherwise use a SME server at home. I will try it again when I get home Sunday night. until then, many thanks for the help.
  3. Hello yes so I let myself be carried away, and then came a new small challenge. In the graph code is the csv file opened and soteret with a "explod" function. and it work fine as long as I only have one column with y data and one with x data. but when I start to get more column's it does not work. I've created a short example below. <?php define("LOG_FILE", "./data/test111/test111-2015-01-17.csv"); $times = array(); $values = array(); $values_test1 = array(); $file_lines = file(LOG_FILE , FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); foreach($file_lines as $line_num => $line_value) { $line_elements = explode(",", $line_value); $times[] = date($line_elements[0]); $values[] = $line_elements[1]; $values_test1[] = $line_elements[2]; } echo $values[2]; ?> the control echo I make "echo $values[2];" works fine, there is be the expected value. but if I try to "echo $values_test1[2];" so there is nothing. the CSV file looks like this. Date,temp1,temp2 2015-01-23-12-00,54,59 2015-01-23-12-01,54,59 2015-01-23-12-02,54,59 2015-01-23-12-03,54,58 2015-01-23-12-04,54,58 2015-01-23-12-05,54,58 2015-01-23-12-06,54,58 2015-01-23-12-07,54,58 2015-01-23-12-08,54,58 2015-01-23-12-09,54,58 2015-01-23-12-10,54,58 2015-01-23-12-11,53,58 2015-01-23-12-12,53,58 2015-01-23-12-13,53,58 2015-01-23-12-14,53,58 why can I not get the temp2 values into $ values_test1 [] thank you very much
  4. hi guys you are just amazing. It works just as I had hoped for, again many thanks. Now we need to work a little with design and things like that. This forum is great, no question seems too stupid, and being helped, thank you.
  5. that one i need some further explanation.
  6. hey it works that's what I do today. I would like to have it on the same page. I think that I have to use a different graph library. possibly some java.
  7. Hello again! It does not work as I expected. I would combine it with the graph, but I only get an error when I press the button. I understand: who is in error description but can it be solved, or do I need to have the graph to run on a page by itself. ? error message looks like this. " Explanation: HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser. For example it is a common mistake to leave a blank line before the opening "<?php". " <?php $dir = './data/test111'; $ddArray1 = scandir($dir,1); ?> <html> <head> <title>Select Drop Down List</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <select name="file"> <?php FOREACH($ddArray1 AS $file){ PRINT '<option value="'.$file.'">'.$file.'</option>'; } ?> </select> <input type="submit"/> </form> </body> </html> <?php if ($_POST) { $id=$_POST['file']; //only echos the 'file' index from the $_POST array //echo $id; define("LOG_FILE", "./data/test111/".$id); require_once('jpgraph/src/jpgraph.php'); require_once('jpgraph/src/jpgraph_line.php'); $times = array(); $values = array(); $file_lines = file(LOG_FILE, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); foreach($file_lines as $line_num => $line_value) { $line_elements = explode(",", $line_value); $times[] = date($line_elements[0]); $values[] = $line_elements[1]; } $graph = new Graph(800, 400); $graph->SetFrame(false); $graph->SetScale('intint'); $graph->SetMarginColor('white'); $graph->title->Set("Temp midt tank"); $graph->xaxis->SetTickLabels($times); $graph->yaxis->scale->SetAutoMin(0); $graph->yaxis->title->Set("°C"); $graph->ygrid->SetFill($aFlg=true, $aColor1='white', $aColor2='gray9'); $lineplot = new LinePlot($values); $lineplot->SetColor('blue'); $graph->Add($lineplot); $graph->Stroke(); } ?>
  8. hi yes it seemed to me that I had tried it, but I was wrong, now I tried it again and now it works, super thank you
  9. the &gt are right not a err. yes it did make a difference, not for the better. but a difference is something. the result is here! Array ( [file] => test111-2015-01-22.csv ) now I can almost imagine where the end brackets come from. but how do I get them removed? Moreover, many thanks for the help.
  10. I have started a new thread this was too cluttered
  11. Hi Yes I start a new thread, this is probably the correct one. I have solved my problem almost. the result ends with the end of a parenthesis. see picture how do I get it deleted. <?php $dir = './data/test111'; $ddArray1 = scandir($dir,1); ?> <html> <head> <title>Select Drop Down List</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <select name="file"> <?php FOREACH($ddArray1 AS $file){ PRINT '<option value="'.$file.'">'.$file.'</option>'; } ?> </select> <input type="submit"/> </form> </body> </html> <?php if ($_POST) { echo '<pre&gt'; print_r($_POST); $test='</pre&gt>'; echo $test; } ?>
  12. Hey, I'll take this thread up again. I have worked a bit with this piece of code. and now I would like to try something new. instead of send the variable to another file. I would like to use the variable in the same file. I have worked a lot with something in this style. but I can not get the dropdown menu to work, So it is not there, this piece of code, I can get to work but lack the drop down menu, which contains the contents of the library. <html> <body> <form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="name"><br> <input type="submit" name="submit" value="Submit Form"><br> </form> <?php $dir = './data/test111'; $name = scandir($dir, 1); echo $name[3]; if(isset($_GET['submit'])) { $file = $_GET['name']; echo " <b> $file </b>"; } ?> </body> </html>
  13. hi yes it is a bit the same conclusion I came to. Sorry I still mess around with what the different things ar called . I believe what I mean is called tables. well no matter I have some things I have to try out, I will return
  14. hmmm have worked a lot with it now. and read about jpgraph, I think the right way is to generate 30 image files and then load them up on a html page afterwards. to just work some more with this solution, but I think that I would be able to get to work. what do you say, is it the right solution?
×
×
  • 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.