[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15002 - in gauger: . css images
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15002 - in gauger: . css images |
Date: |
Fri, 15 Apr 2011 17:16:10 +0200 |
Author: bartpolot
Date: 2011-04-15 17:16:10 +0200 (Fri, 15 Apr 2011)
New Revision: 15002
Added:
gauger/images/toomanyunits.png
Modified:
gauger/css/style.css
gauger/plot.php
gauger/template.php
gauger/template_host.php
Log:
Improved multi-unit plot handling, improved user-friendlyness of metric
addition in host view
Modified: gauger/css/style.css
===================================================================
--- gauger/css/style.css 2011-04-15 14:10:45 UTC (rev 15001)
+++ gauger/css/style.css 2011-04-15 15:16:10 UTC (rev 15002)
@@ -346,6 +346,10 @@
background: white;
}
+.control-column p {
+ margin: 2px;
+}
+
.select-metric {
width: 95px;
font-size: 90%;
Added: gauger/images/toomanyunits.png
===================================================================
(Binary files differ)
Property changes on: gauger/images/toomanyunits.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: gauger/plot.php
===================================================================
--- gauger/plot.php 2011-04-15 14:10:45 UTC (rev 15001)
+++ gauger/plot.php 2011-04-15 15:16:10 UTC (rev 15002)
@@ -117,7 +117,6 @@
}
$plotcmd = ' plot';
- $units = Array();
$c = 0;
if($x_min == '*' || $x_max == '*') {
foreach($h as $host) {
@@ -135,16 +134,25 @@
}
}
}
+ $left_unit = null;
+ $right_unit = null;
foreach($h as $host) {
$counters = $hosts[$host];
if($cg == 0) $g = $counters;
foreach($g as $graph) {
if(array_search($graph, $counters) === FALSE) continue;
$unit = get_counter_unit($graph);
- $units[$unit] = 1;
- if(count($units) > 2) {
- die('TOOMANYUNITS');
+ if($left_unit === null) {
+ $left_unit = $unit;
}
+ if($left_unit != $unit && $right_unit === null) {
+ $right_unit = $unit;
+ $cmd .= " set y2label \"$unit\"; set ytics nomirror; set
y2tics;";
+ }
+ if($left_unit != $unit && $right_unit != $unit) {
+ header('Location: images/toomanyunits.png');
+ die();
+ }
$counter = get_counter_name($graph);
if($c) $plotcmd .= ',';
$plotcmd .= escapeshellcmd(" \"$DATADIR$host/$graph.dat\"");
@@ -155,20 +163,26 @@
$plotcmd .= " title \"";
if($ch != 1) $plotcmd .= $host;
if($ch != 1 && $cg != 1) $plotcmd .= " - ";
- if($cg != 1) $plotcmd .= $counter;
+ if($cg != 1) {
+ $plotcmd .= $counter;
+ if($unit == $right_unit) $plotcmd .= " ($unit)";
+ }
$plotcmd .= "\"";
$plotcmd .= " with lines lw 2";
+ if($unit == $right_unit) $plotcmd .= ' axes x1y2';
if($ch == 1 && $cg == 1) {
$plotcmd .= ', ';
$plotcmd .= escapeshellcmd(" \"$DATADIR$host/$graph.dat\"");
$plotcmd .= " notitle with yerrorbars lw 1";
+ if($unit == $right_unit) $plotcmd .= ' axes x1y2';
}
$c++;
}
}
$size = get_param_escsh('png_x_size');
$gap = $range_end - $range_start;
- $interval = ceil($gap/(abs($size-150)/50));
+ $deadspace = $right_unit === null ? 150 : 220;
+ $interval = ceil($gap/(abs($size-$deadspace)/50));
if($interval > $gap) $interval = $gap;
if($interval == 0) $interval = 1;
$rangecmd = " set xtics $range_start,$interval,$range_end;";
Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-04-15 14:10:45 UTC (rev 15001)
+++ gauger/template.php 2011-04-15 15:16:10 UTC (rev 15002)
@@ -402,6 +402,13 @@
</li>'
);
$(this).parents("tr").find("option[value=" + x +
"]").remove();
+
$(this).parents("tr").find("option:not(.same-unit-metric)").each(function() {
+ if(get_unit(this.value) == get_unit(x)) {
+ $(this).addClass('second-unit-metric');
+ } else {
+ $(this).addClass('incompatible-unit-metric');
+ }
+ });
$(this).parents("tr").find(".plot").each(function() {
this.src = this.src.replace(/(g=[^&]+)/g, '$1,'+x);
});
@@ -411,12 +418,30 @@
function rescan_added_hosts(that) {
var graphs = "";
var sep = "";
+ var x = null;
var links =
$(that).parents("ul").find(".added-metric:checked").parents("li").find("a").get().reverse();
for(i in links) {
graph = "" + links[i];
- graphs += sep + graph.replace(/.*graph=([^&]+).*/g, "$1");
+ graph = graph.replace(/.*graph=([^&]+).*/g, "$1");
+ graphs += sep + graph;
+ if(x == null && i != 0) {
+ x = graph;
+ debug(x);
+ }
sep = ",";
}
+
$(that).parents("tr").find("option:not(.same-unit-metric)").each(function() {
+ if(x != null) {
+ if(get_unit(this.value) == get_unit(x)) {
+
$(this).removeClass('incompatible-unit-metric').addClass('second-unit-metric');
+ } else {
+
$(this).removeClass('second-unit-metric').addClass('incompatible-unit-metric');
+ }
+ } else {
+ $(this).removeClass('second-unit-metric');
+ $(this).removeClass('incompatible-unit-metric');
+ }
+ });
$(that).parents("tr").find(".plot").each(function() {
this.src = this.src.replace(/&g=[^&]+/g, '')+"&g="+graphs;
});
Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php 2011-04-15 14:10:45 UTC (rev 15001)
+++ gauger/template_host.php 2011-04-15 15:16:10 UTC (rev 15002)
@@ -75,7 +75,9 @@
<ul class="added-metrics">
<li>
<input type="checkbox" checked="checked"
class="added-metric" disabled>
- <a href="?graph=<?php echo $counter ?>"><?php echo
get_counter_name($counter) ?></a>
+ <a href="?graph=<?php echo $counter ?>" title="<?php
echo '['.get_counter_category($counter).'] '. get_counter_name($counter)?>">
+ <?php echo get_counter_name($counter) ?>
+ </a>
</li>
</ul>
<hr/>
@@ -94,6 +96,10 @@
<?php endforeach; ?>
</select>
<input type="button" value="Add" class="add-metric"></input>
+ <br/>
+ <p class="same-unit-metric">Same unit</p>
+ <p class="second-unit-metric">Second unit</p>
+ <p class="incompatible-unit-metric">Incompatible</p>
</th>
<td height="<?php echo get_session('png_y_size')+2 ?>"
width="<?php echo get_session('png_x_size')+2 ?>"><img class="plot"
src="plot.php?h=<?php echo "$current&g=$counter" ?>" alt="loading..."/></td>
</tr>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15002 - in gauger: . css images,
gnunet <=