/** * * @return string: Not needed jsut here for testing * This writes the data file needed to execute GNUPlot */ public function testingDefults($xyTable) { require site_get_config_main(); $outAdress = $this->plot_path; $plotPath = $this->slashReplace($outAdress . $this->plotName); $xyTable = $this->slashReplace($xyTable); $f = fopen($this->opsFileAdressAndName, "w"); fwrite($f, "set terminal png" . "\r\n"); fwrite($f, 'set xlabel "Time Integrations (sec)"' . "\r\n"); fwrite($f, 'set ylabel "Allan Variance (Sigma^2(T))"' . "\r\n"); fwrite($f, 'set title "Stability Plot"' . "\r\n"); fwrite($f, 'set logscale' . "\r\n"); fwrite($f, "set output '" . $plotPath . "'\r\n"); fwrite($f, 'set datafile separator ";"' . "\r\n"); fwrite($f, 'set arrow from 0.05,5e-7 to 100,5e-7 nohead linestyle 1 ' . "\r\n"); fwrite($f, 'set xrange [1e-2:1e3]' . "\r\n"); fwrite($f, "set format y '%.1e'" . "\r\n"); fwrite($f, "set format y '%.1g'" . "\r\n"); fwrite($f, "set format x '%.1e'" . "\r\n"); fwrite($f, "set format x '%.1g'" . "\r\n"); fwrite($f, "set object 1 rect from 300,4e-6 to 302,4e-6 lw 5" . "\r\n"); fwrite($f, "plot '" . $xyTable . "' using 1:2 title 'AVAR' with linespoints" . "\r\n"); fclose($f); $img = $this->slashReplace($this->URL . $this->plotName); echo "<br>"; echo $img . "<br>"; $x = $this->slashReplace($this->opsFileAdressAndName); echo $x . "<br>"; system("{$GNUPLOT} {$x}"); echo "<img src = '{$img}'><br>"; }
public function __construct($dataFile, $tmpName) { $this->timeStamp = time(); require site_get_config_main(); // establish defult directories $masterDir = $main_write_directory; // this will be the "root Dir" $this->uploadAdress = $masterDir; // here is where user input will be placed $this->outPutAdress = $masterDir; // here is where final files will be placed $this->plotURL = $main_url_directory; $this->opsFile = $masterDir; // make if dir does not exits if (!file_exists($masterDir)) { mkdir($masterDir); } // upload the file that will be plotted $this->dataName = $dataFile; move_uploaded_file($tmpName, $this->uploadAdress . $dataFile); }