From 25da29e816e4914fbdd99d53fa0e3a71b64b1225 Mon Sep 17 00:00:00 2001 From: "mcafee%netscape.com" Date: Sun, 5 May 2002 08:14:00 +0000 Subject: [PATCH] Trying out new cgi parameter showpoint, &showpoint=2002:03:21:06:52:28,4087 will print a big point there, e.g. highlighting one of the data points --- webtools/graph/graph.cgi | 21 +++++++++++++++++++++ webtools/graph/query.cgi | 27 +++++++++++++++------------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/webtools/graph/graph.cgi b/webtools/graph/graph.cgi index b931fff72d10..968ebbd6ffa3 100755 --- a/webtools/graph/graph.cgi +++ b/webtools/graph/graph.cgi @@ -14,6 +14,7 @@ my $SIZE = lc($req->param('size')); my $DAYS = lc($req->param('days')); my $LTYPE = lc($req->param('ltype')); my $POINTS = lc($req->param('points')); +my $SHOWPOINT = lc($req->param('showpoint')); my $AVG = lc($req->param('avg')); my $DATAFILE = "db/$TESTNAME/$TBOX"; @@ -159,6 +160,18 @@ sub show_graph { $plot_cmd = "plot \"$DATAFILE\" using 1:2 with $ltype"; } + # Highlight a point, e.g. 2002:03:21:06:52:28,4087 + if($SHOWPOINT) { + my @xy = split(",",$SHOWPOINT); + + open POINTFILE, ">db/$TESTNAME/point.txt"; + print POINTFILE "$xy[0]\t$xy[1]\n"; + close POINTFILE; + + $plot_cmd .= ", \"db/$TESTNAME/point.txt\" using 1:2 with points ls 4"; + } + + if (($AVG) and (-e $DATAFILE_AVG)) { $plot_cmd .= ", \"$DATAFILE_AVG\" using 1:2 with lines ls 3"; #$plot_cmd .= ", \"$DATAFILE_AVG\" using 1:2 smooth bezier ls 3"; @@ -181,6 +194,7 @@ sub show_graph { set linestyle 1 lt 3 lw 1 pt 7 ps .5 set linestyle 2 lt 3 lw 1 pt 7 ps 1 set linestyle 3 lt 3 lw 1 + set linestyle 4 lt 7 lw 1 pt 7 ps 3 set data style points set timefmt "%Y:%m:%d:%H:%M:%S" set xdata time @@ -191,6 +205,7 @@ sub show_graph { set nokey set grid $plot_cmd + $plot_cmd2 }; # plot "$DATAFILE" using 1:2 with points ps 1, "$DATAFILE" using 1:2 with lines ls 2 @@ -206,6 +221,12 @@ sub show_graph { close (GNUPLOT) || die "can't close: $!"; unlink $PNGFILE || die "can't unlink $PNGFILE: $!"; + + # Cleanup generated files. + if($SHOWPOINT) { + unlink("db/$TESTNAME/point.txt"); + } + print "Content-type: image/png\n\n"; print $blob; } diff --git a/webtools/graph/query.cgi b/webtools/graph/query.cgi index a1936cc38aba..3bfd1d70edef 100755 --- a/webtools/graph/query.cgi +++ b/webtools/graph/query.cgi @@ -14,6 +14,7 @@ my $SIZE = lc($req->param('size')); my $DAYS = lc($req->param('days')); my $LTYPE = lc($req->param('ltype')); my $POINTS = lc($req->param('points')); +my $SHOWPOINT = lc($req->param('showpoint')); my $AVG = lc($req->param('avg')); @@ -62,7 +63,7 @@ sub print_testnames { my $machines_string = join(" ", @machines); foreach (@machines) { - print "
  • $_\n"; + print "
  • $_\n"; } print ""; @@ -86,7 +87,7 @@ sub print_machines { my $machines_string = join(" ", @machines); foreach (@machines) { - print "
  • $_\n"; + print "
  • $_\n"; } print ""; @@ -111,11 +112,11 @@ sub show_graph { print "\n"; if($AUTOSCALE) { print "Y-axis: (zoom|"; - print "100%"; + print "100%"; print ") \n"; } else { print "Y-axis: ("; - print "zoom"; + print "zoom"; print "|100%) \n"; } print "\n"; @@ -132,11 +133,12 @@ sub show_graph { print ""; print ""; print ""; + print ""; print ""; print "Days:"; if($DAYS) { - print "(all data|"; + print "(all data|"; print ""; print ")\n"; } else { @@ -154,12 +156,12 @@ sub show_graph { print "Style:"; if($LTYPE eq "steps") { print "("; - print "lines"; + print "lines"; print "|steps"; print ")"; } else { print "(lines|"; - print "steps"; + print "steps"; print ")"; } print "\n"; @@ -171,11 +173,11 @@ sub show_graph { print "Points:"; if($POINTS) { print "(on|"; - print "off"; + print "off"; print ")\n"; } else { print "("; - print "on"; + print "on"; print "|off)\n"; } print "\n"; @@ -188,11 +190,11 @@ sub show_graph { print "Average:"; if($AVG) { print "(on|"; - print "off"; + print "off"; print ")\n"; } else { print "("; - print "on"; + print "on"; print "|off)\n"; } print "\n"; @@ -206,7 +208,7 @@ sub show_graph { # graph - print "\"$TBOX"; + print "\"$TBOX"; print "
    \n"; print "
    \n"; @@ -273,6 +275,7 @@ sub show_graph { print ""; print ""; print ""; + print ""; print ""; print "Graph size:";