[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14394 - gauger
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14394 - gauger |
Date: |
Fri, 11 Feb 2011 23:55:09 +0100 |
Author: bartpolot
Date: 2011-02-11 23:55:09 +0100 (Fri, 11 Feb 2011)
New Revision: 14394
Modified:
gauger/header.gp
gauger/plot.php
gauger/template_graph.php
gauger/template_host.php
Log:
Added support for generic on-demand plotting, changed default styles
Modified: gauger/header.gp
===================================================================
--- gauger/header.gp 2011-02-11 17:55:21 UTC (rev 14393)
+++ gauger/header.gp 2011-02-11 22:55:09 UTC (rev 14394)
@@ -2,3 +2,12 @@
set grid;
set yrange[0:];
set key below;
+set style lines 1 lt rgb "#A0A0A0" lw 2
+set style lines 2 lt rgb "#404040" lw 1 pt 1
+set style lines 3 lt rgb "green" lw 2
+set style lines 4 lt rgb "red" lw 2
+set style lines 5 lt rgb "blue" lw 2
+set style lines 6 lt rgb "cyan" lw 2
+set style lines 7 lt rgb "violet" lw 2
+set style lines 8 lt rgb "orange" lw 2
+set style increment user;
Modified: gauger/plot.php
===================================================================
--- gauger/plot.php 2011-02-11 17:55:21 UTC (rev 14393)
+++ gauger/plot.php 2011-02-11 22:55:09 UTC (rev 14394)
@@ -5,42 +5,60 @@
* @param g: graph name
* @return: stream representing a png graph
*/
-function plot($h = '', $g = '') {
+function plot($g = array(), $h = array()) {
$cmd = 'load "header.gp";';
- $cmd .= 'plot';
+ $cmd .= ' plot';
global $hosts;
- if(empty($h)) {
- if(empty($g)) {
- return 'ERROR1';
- }
- $c = 0;
- foreach($hosts as $host => $counters) {
- if(array_search($g, $counters) === FALSE) continue;
+ $ch = count($h);
+ $cg = count($g);
+
+ if($ch == 0){
+ $h = array_keys($hosts);
+ }
+
+ $c = 0;
+ foreach($h as $host) {
+ $counters = $hosts[$host];
+ if($cg == 0) $g = $counters;
+ foreach($g as $graph) {
+ if(array_search($graph, $counters) === FALSE) continue;
if($c) $cmd .= ',';
- $cmd .= " \"$host/$g.dat\" title \"$host\" with lines lw 2";
+ $cmd .= " \"$host/$graph.dat\"";
+ $cmd .= " title \"";
+ if($ch != 1) $cmd .= $host;
+ if($ch != 1 && $cg != 1) $cmd .= " - ";
+ if($cg != 1) $cmd .= $graph;
+ $cmd .= "\"";
+ $cmd .= " with lines lw 2";
+ if($ch == 1 && $cg == 1) $cmd .= ", \"$host/$graph.dat\" notitle
with yerrorbars lw 1";
$c++;
}
- if(!$c) return 'ERROR2';
- } else {
- $c = 0;
- foreach($hosts as $host => $counters) {
- if(array_search($g, $counters) === FALSE) continue;
- if($c) $cmd .= ',';
- $cmd .= " \"$host/$g.dat\" title \"$host\" with lines lw 2";
- $c++;
- }
- if(!$c) return 'ERROR3';
}
+
+ if(!$c) die('NODATA');
+
+//print_r($h);
+//print_r($g);
+//die($cmd);
$cmd = "echo '$cmd' | gnuplot";
$out = shell_exec($cmd);
return $out;
}
+include "explore.php";
+
+$h = array();
+if (array_key_exists('h', $_REQUEST)) {
+ $h = explode(',', $_REQUEST['h']);
+}
+
+$g = array();
if (array_key_exists('g', $_REQUEST)) {
- include "explore.php";
- header('Content-type: image/png');
- $out = plot('', $_REQUEST['g']);
- die($out);
+ $g = explode(',', $_REQUEST['g']);
}
+
+$out = plot($g, $h);
+header('Content-type: image/png');
+die($out);
Modified: gauger/template_graph.php
===================================================================
--- gauger/template_graph.php 2011-02-11 17:55:21 UTC (rev 14393)
+++ gauger/template_graph.php 2011-02-11 22:55:09 UTC (rev 14394)
@@ -1,4 +1,3 @@
<h1>SHOWING GRAPH: <?php echo $currentg ?></h1>
<img src="plot.php?g=<?php echo $currentg ?>" alt="PNG not found :("/>
<p>TODO: Select hosts | Range | Normalize </p>
-
\ No newline at end of file
Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php 2011-02-11 17:55:21 UTC (rev 14393)
+++ gauger/template_host.php 2011-02-11 22:55:09 UTC (rev 14394)
@@ -1,26 +1,26 @@
- <?php if (isset($hosts[$current])): ?>
- <h1>SHOWING HOST: <?php echo $current ?></h1>
- <?php if (!empty($hosts[$current])): ?>
- <table>
- <tr>
- <th>Counter</th>
- <th>Graph</th>
- <th>Controls</th>
- </tr>
- <?php foreach ($hosts[$current] as $counter): ?>
- <tr>
- <th><?php echo $counter ?></th>
- <td><img src="<?php echo $current . '/' . $counter .
'.png' ?>" alt="PNG not found :("/></td>
- <td><a href="?graph=<?php echo $counter
?>">Compare</a><br/>
- <br/>TODO:<br/>Range<br/>Add
counter<br/>Colors</td>
- </tr>
- <?php endforeach; ?>
- </table>
- <?php else: ?>
- <h1>The host "<?php echo $current ?>" has no counters</h1>
- <?php endif; ?>
- <?php else: ?>
- <h1>Please select a host from the hosts menu.</h1>
- <p>Some very useful data / overview will go here</p>
- <pre><?php print_r($hosts); echo $current ?></pre>
- <?php endif; ?>
+<?php if (isset($hosts[$current])): ?>
+ <h1>SHOWING HOST: <?php echo $current ?></h1>
+ <?php if (!empty($hosts[$current])): ?>
+ <table>
+ <tr>
+ <th>Counter</th>
+ <th>Graph</th>
+ </tr>
+ <?php foreach ($hosts[$current] as $counter): ?>
+ <tr>
+ <th>
+ <?php echo $counter ?><br/><br/>
+ <a href="?graph=<?php echo $counter ?>">Compare</a><br/>
+ <br/>TODO:<br/>Range<br/>Add counter<br/>Colors
+ </th>
+ <td><img src="<?php echo $current . '/' . $counter . '.png' ?>"
alt="PNG not found :("/></td>
+ </tr>
+ <?php endforeach; ?>
+ </table>
+ <?php else: ?>
+ <h1>The host "<?php echo $current ?>" has no counters</h1>
+ <?php endif; ?>
+<?php else: ?>
+ <h1>Please select a host from the hosts menu.</h1>
+ <p>Some very useful data / overview will go here</p>
+<?php endif; ?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14394 - gauger,
gnunet <=