Jump to content

kimjessen

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by kimjessen

  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?
  15. hi I've tried to fiddle with this for () loop. but it does not work. I have attached here a simple example of the graph how will you print that FX. 3 times, below each other. <?php // content="text/plain; charset=utf-8" require_once('jpgraph/src/jpgraph.php'); require_once('jpgraph/src/jpgraph_line.php'); $datay1 = array(20,15,23,15); // Setup the graph $graph = new Graph(300,250); $graph->SetScale("textlin"); $theme_class=new UniversalTheme; $graph->SetTheme($theme_class); $graph->img->SetAntiAliasing(false); $graph->title->Set('Filled Y-grid'); $graph->SetBox(false); $graph->img->SetAntiAliasing(); $graph->yaxis->HideZeroLabel(); $graph->yaxis->HideLine(false); $graph->yaxis->HideTicks(false,false); $graph->xgrid->Show(); $graph->xgrid->SetLineStyle("solid"); $graph->xaxis->SetTickLabels(array('A','B','C','D')); $graph->xgrid->SetColor('#E3E3E3'); // Create the first line $p1 = new LinePlot($datay1); $graph->Add($p1); $p1->SetColor("#6495ED"); $p1->SetLegend('Line 1'); $graph->legend->SetFrameWeight(1); // Output line $graph->Stroke(); ?>
  16. it will depend on how many files are in the library. I count them and put in as a variable. but it is typically 30-31 days. but you write it as if it is no problem? will the graphs come below each other or there will be 30 new pages.?
  17. hey now I have to put the pieces together. The project consists in the analysis of weather and solar radiation. I have a solar power plant on my roof and I would do some analysis on it. and while it get a little experience with php. so now I have found out to buffer data to my serwer. I have also found out how to make a graph. I have also found out how I'll get it right CSV file from the server. super! Now I would like to analyze it. is it possible to have PHP. to construct multiple frames. Understood in this way that when the first graph is made ther is automatically made ​​a new frame with the next day's graph ETC. it is possible any suggestions. I use JPgraph to the graph part
  18. hi there. thanks for a punch in the right direction. with a little tweaking I got what I wanted. <html> <body> <?php $dir = '/xampp/htdocs/php fil var'; $ddArray1 = scandir($dir, 1); ?> <form action = "test_2.php" method = "post"> <select name="file"> <?php FOREACH($ddArray1 AS $file){ PRINT '<option value="'.$file.'">'.$file.'</option>'; } ?> </select> adjustment: <input type="text" name="adjustment"><br> <input type="submit"> </form> </body> </html>
  19. Hello! working on something where I need to use the file names in a specific directory. I would like to do it in style with form post and send the result to another php file. What I exactly want to do is. I would like to have a page where I need to be able to do two things. I should be able to enter a value + in a drop down menu should be able to choose one of the file names in the specific custom directory. I have found out how to found the contents of a directory + drop down menu. but I can not exactly figure out how to get it into an post form.? <?php $dir = '/xampp/htdocs/filvar'; $ddArray1 = scandir($dir, 1); //print_r($ddArray1); //echo $ddArray1[5]; PRINT '<select name="Words">'; FOREACH($ddArray1 AS $word){ PRINT '<option value="'.$word.'">'.$word.'</option>'; } PRINT '</select>'; ?> it is basic so far I have come but I would like to get it all into a <form action = "test.php" method = "post"> thing but it managed not right for me.
  20. hey it's because I'm a beginner. I am working to get a handle on it.
  21. have solved it $date = date('dmy'); $prefix="Temp-"; $suffix=$date; $filename=$prefix.$suffix.".csv"; // Solution define("LOG_FILE", $filename); if(!isset($_GET["temp"])) ; $temp = $_GET["temp"]; $date=gmdate("Y-m-d-h-i", time()); $file_handler = fopen(LOG_FILE, "a+"); fwrite($file_handler, $date . "," . $temp . "\n"); fflush($file_handler); echo "OK";
  22. hi! I work a little to save some data in a CSV file. and I have come so far $date = date('dmy'); define("LOG_FILE", $date); if(!isset($_GET["temp"])) ; $temp = $_GET["temp"]; $date=gmdate("Y-m-d-h-i", time()); $file_handler = fopen(LOG_FILE, "a+"); fwrite($file_handler, $date . "," . $temp . "\n"); fflush($file_handler); echo "OK"; it works well. I would like to combine the filename with a text FX. water level + the date .csv but I can not get it to work for someone who will help
  23. You may just get the code here. It is an MPU kit Arduino type I work with. client.connect(XXXXXX.YYY, 8005); delay(10); Ethernet.maintain(); Serial.println("connecting..."); if (client.connected()) { Serial.println("connected"); client.println("GET /invput?id=serinummer1234&data=1,2,3,4,5,6,7,8,9 HTTP/1.1"); client.println("Host: XXXXXX.YYY"); client.println("Connection: close"); client.println();
×
×
  • 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.