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

This commit is contained in:
mcafee%netscape.com 2002-05-05 08:14:00 +00:00
parent c355d8c308
commit 25da29e816
2 changed files with 36 additions and 12 deletions

View File

@ -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;
}

View File

@ -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 "<li><a href=query.cgi?&testname=$_$testname&tbox=$tbox&autoscale=$autoscale&size=$SIZE&days=$days&units=$units&ltype=$ltype&points=$points&avg=$avg>$_</a>\n";
print "<li><a href=query.cgi?&testname=$_$testname&tbox=$tbox&autoscale=$autoscale&size=$SIZE&days=$days&units=$units&ltype=$ltype&points=$points&showpoint=$showpoint&avg=$avg>$_</a>\n";
}
print "</ul></td></tr></table></td></tr></table>";
@ -86,7 +87,7 @@ sub print_machines {
my $machines_string = join(" ", @machines);
foreach (@machines) {
print "<li><a href=query.cgi?tbox=$_&testname=$testname&autoscale=$autoscale&size=$SIZE&days=$days&units=$units&ltype=$ltype&points=$points&avg=$avg>$_</a>\n";
print "<li><a href=query.cgi?tbox=$_&testname=$testname&autoscale=$autoscale&size=$SIZE&days=$days&units=$units&ltype=$ltype&points=$points&avg=$avg&showpoint=$showpoint>$_</a>\n";
}
print "</ul></td></tr></table></td></tr></table>";
@ -111,11 +112,11 @@ sub show_graph {
print "<font size=\"-1\">\n";
if($AUTOSCALE) {
print "Y-axis: (<b>zoom</b>|";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=0&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&avg=$AVG\">100%</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=0&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">100%</a>";
print ") \n";
} else {
print "Y-axis: (";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=1&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&avg=$AVG\">zoom</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=1&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">zoom</a>";
print "|<b>100%</b>) \n";
}
print "</font>\n";
@ -132,11 +133,12 @@ sub show_graph {
print "<input type=hidden name=\"units\" value=\"$UNITS\">";
print "<input type=hidden name=\"ltype\" value=\"$LTYPE\">";
print "<input type=hidden name=\"points\" value=\"$POINTS\">";
print "<input type=hidden name=\"showpoint\" value=\"$SHOWPOINT\">";
print "<input type=hidden name=\"avg\" value=\"$AVG\">";
print "Days:";
if($DAYS) {
print "(<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=0&units=$UNITS&ltype=$LTYPE&points=$POINTS&avg=$AVG\">all data</a>|";
print "(<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=0&units=$UNITS&ltype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">all data</a>|";
print "<input type=text value=$DAYS name=\"days\" size=3 maxlength=10>";
print ")\n";
} else {
@ -154,12 +156,12 @@ sub show_graph {
print "Style:";
if($LTYPE eq "steps") {
print "(";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=lines&points=$POINTS&avg=$AVG\">lines</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=lines&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">lines</a>";
print "|<b>steps</b>";
print ")";
} else {
print "(<b>lines</b>|";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=steps&points=$POINTS&avg=$AVG\">steps</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=steps&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\">steps</a>";
print ")";
}
print "</font>\n";
@ -171,11 +173,11 @@ sub show_graph {
print "Points:";
if($POINTS) {
print "(<b>on</b>|";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=0&avg=$AVG\">off</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=0&showpoint=$SHOWPOINT&avg=$AVG\">off</a>";
print ")\n";
} else {
print "(";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=1&avg=$AVG\">on</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=1&showpoint=$SHOWPOINT&avg=$AVG\">on</a>";
print "|<b>off</b>)\n";
}
print "</font>\n";
@ -188,11 +190,11 @@ sub show_graph {
print "<A title=\"Moving average of last 10 points\">Average:</a>";
if($AVG) {
print "(<b>on</b>|";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&avg=0\">off</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=0\">off</a>";
print ")\n";
} else {
print "(";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&avg=1\">on</a>";
print "<a href=\"query.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=1\">on</a>";
print "|<b>off</b>)\n";
}
print "</font>\n";
@ -206,7 +208,7 @@ sub show_graph {
# graph
print "<img src=\"graph.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&avg=$AVG\" alt=\"$TBOX $TESTNAME graph\">";
print "<img src=\"graph.cgi?tbox=$TBOX&testname=$TESTNAME&autoscale=$AUTOSCALE&size=$SIZE&days=$DAYS&units=$UNITS&ltype=$LTYPE&points=$POINTS&showpoint=$SHOWPOINT&avg=$AVG\" alt=\"$TBOX $TESTNAME graph\">";
print "<br>\n";
print "<br>\n";
@ -273,6 +275,7 @@ sub show_graph {
print "<input type=hidden name=\"units\" value=\"$UNITS\">";
print "<input type=hidden name=\"ltype\" value=\"$LTYPE\">";
print "<input type=hidden name=\"points\" value=\"$POINTS\">";
print "<input type=hidden name=\"showpoint\" value=\"$SHOWPOINT\">";
print "<input type=hidden name=\"avg\" value=\"$AVG\">";
print "Graph size:";