[rkward-cvs] SF.net SVN: rkward: [1223] trunk/rkward/rkward/plugins/plots/histogram.php
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Jan 25 18:40:10 UTC 2007
Revision: 1223
http://svn.sourceforge.net/rkward/?rev=1223&view=rev
Author: tfry
Date: 2007-01-25 10:40:10 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
Simplify PHP code for histogram
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/histogram.php
Modified: trunk/rkward/rkward/plugins/plots/histogram.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram.php 2007-01-25 17:52:16 UTC (rev 1222)
+++ trunk/rkward/rkward/plugins/plots/histogram.php 2007-01-25 18:40:10 UTC (rev 1223)
@@ -6,43 +6,18 @@
}
function printout () {
- global $scale;
- global $bw;
- global $adjust;
- global $narm;
- global $giveRkern;
- global $x;
- global $breaksopt;
-
- preparedata ();
-?>
-rk.header ("Histogram", list ("Frequency", "<? echo $scale; ?>", "Breaks algorithm", <? echo ("\"" . $breaks . "\""); ?>, "Variable", rk.get.description (<? echo ($x); ?>)))
-rk.graph.on ()
-<? makeplotcommand (); ?>
-rk.graph.off ()
-<?
+ doPrintout (true);
}
function cleanup () {
}
function preview () {
- preparedata ();
- makeplotcommand ();
+ doPrintout (false);
}
-
-
-// internal helper functions below;
-function preparedata () {
- global $scale;
- global $bw;
- global $adjust;
- global $narm;
- global $giveRkern;
- global $x;
- global $breaksopt;
-
+// internal helper functions
+function doPrintout ($final) {
$breaks = getRK_val ("breaks");
$scale = getRK_val ("scale");
$bw = getRK_val ("bw");
@@ -56,16 +31,12 @@
} else if (!empty ($breaks)) {
$breaksopt = "breaks=\"" . $breaks . "\"";
}
-}
-function makeplotcommand () {
- global $scale;
- global $bw;
- global $adjust;
- global $narm;
- global $giveRkern;
- global $x;
- global $breaksopt;
+ if ($final) { ?>
+rk.header ("Histogram", list ("Frequency", "<? echo $scale; ?>", "Breaks algorithm", <? echo ("\"" . $breaks . "\""); ?>, "Variable", rk.get.description (<? echo ($x); ?>)))
+
+rk.graph.on ()
+<? }
?>
try ({
hist (<? echo ($x); ?>, <? echo ($breaksopt); ?>, freq = <? echo $scale; ?><? getRK ("plotoptions.code.printout"); ?>)
@@ -73,7 +44,9 @@
lines(density(<? echo ($x); ?>, bw="<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, <? echo ($narm); ?>, n = <? getRK ("n"); ?>), col= "<? getRK ("col_density"); ?>")
<? } ?>
})
-<?
+<? if ($final) { ?>
+rk.graph.off ()
+<? }
}
?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list