[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14457 - gauger
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14457 - gauger |
Date: |
Fri, 18 Feb 2011 05:39:25 +0100 |
Author: bartpolot
Date: 2011-02-18 05:39:25 +0100 (Fri, 18 Feb 2011)
New Revision: 14457
Modified:
gauger/plot.php
gauger/template.php
Log:
Added xtics interval optimization, fixed js counter update bug
Modified: gauger/plot.php
===================================================================
--- gauger/plot.php 2011-02-18 03:00:11 UTC (rev 14456)
+++ gauger/plot.php 2011-02-18 04:39:25 UTC (rev 14457)
@@ -15,7 +15,7 @@
if(!empty($g)) $cmd .= ' set ylabel "' . get_counter_unit($g[0]) . '";';
foreach (Array('x_max', 'x_min', 'y_max', 'y_min') as $param_name) {
- $$param_name = get_param($param_name, '', get_param('persist') == '1');
+ $$param_name = get_param($param_name, '',
false);//get_param('persist') == '1'
if(!is_numeric($$param_name)) $$param_name = '*';
}
$cmd .= " set xrange [$x_min:$x_max];";
@@ -26,12 +26,23 @@
$h = array_keys($hosts);
}
$cg = count($g);
-
if($cg == 1) {
$cmd .= ' set title "' . get_counter_name($g[0]) . '";';
}
- $cmd .= ' plot';
+ if($x_min != '*') {
+ $range_start = $x_min;
+ } else {
+ $range_start = get_param('xrange_max');
+ }
+ if($x_max != '*') {
+ $range_end = $x_max;
+ } else {
+ $range_end = get_param('xrange_min');
+ }
+
+
+ $plotcmd = ' plot';
$units = Array();
$c = 0;
foreach($h as $host) {
@@ -45,31 +56,46 @@
die('TOOMANYUNITS');
}
$counter = get_counter_name($graph);
- if($c) $cmd .= ',';
- $cmd .= " \"$host/$graph.dat\"";
- $cmd .= " title \"";
- if($ch != 1) $cmd .= $host;
- if($ch != 1 && $cg != 1) $cmd .= " - ";
- if($cg != 1) $cmd .= $counter;
- $cmd .= "\"";
- $cmd .= " with lines lw 2";
- if($ch == 1 && $cg == 1) $cmd .= ", \"$host/$graph.dat\" notitle
with yerrorbars lw 1";
+ if($c) $plotcmd .= ',';
+ $plotcmd .= " \"$host/$graph.dat\"";
+ $plotcmd .= " title \"";
+ if($ch != 1) $plotcmd .= $host;
+ if($ch != 1 && $cg != 1) $plotcmd .= " - ";
+ if($cg != 1) $plotcmd .= $counter;
+ $plotcmd .= "\"";
+ $plotcmd .= " with lines lw 2";
+ if($ch == 1 && $cg == 1) $plotcmd .= ", \"$host/$graph.dat\"
notitle with yerrorbars lw 1";
$c++;
+ if($x_min == '*') {
+ $r = get_range($host, $graph);
+ $range_start = min($range_start, $r[0]);
+ }
+ if($x_max == '*') {
+ $r = get_range($host, $graph);
+ $range_end = max($range_end, $r[1]);
+ }
}
}
+ $size = get_param('png_x_size');
+ $gap = $range_end - $range_start;
+ $interval = ceil($gap/(abs($size-150)/50));
+ if($interval > $gap) $interval = $gap;
+ //die( "$interval = round($gap/(($size-150)/60))");
+ $rangecmd = " set xtics $range_start,$interval,$range_end;";
+ //$rangecmd .= " set x2label \"$gap $interval\";";
// echo '<pre>';
// print_r($hosts);
// print_r($h);
// print_r($g);
-// die($cmd);
+// die($rangecmd);
if(!$c) {
header('Location: nodata.png');
die();
}
- $cmd = "echo '$cmd' | gnuplot";
+ $cmd = "echo '$cmd $rangecmd $plotcmd' | gnuplot";
if(get_param('raw_cmd') == 'true')
die($cmd);
$out = shell_exec($cmd);
Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-02-18 03:00:11 UTC (rev 14456)
+++ gauger/template.php 2011-02-18 04:39:25 UTC (rev 14457)
@@ -24,7 +24,9 @@
slide: function( event, ui ) {
if(this.id == "default_range_slider") {
$(this).parents(".slider_control").find(".left-range").html(ui.values[0]);
+
$(".side_slider_control").find(".left-range").html(ui.values[0]);
$(this).parents(".slider_control").find(".right-range").html(ui.values[1]);
+
$(".side_slider_control").find(".right-range").html(ui.values[1]);
if($(this).slider('values', 0) !=
ui.values[0]) {
$( ".auto_min" ).attr('checked',
false);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14457 - gauger,
gnunet <=