[rkward-cvs] SF.net SVN: rkward: [1976] trunk/rkward/rkward/plugins/plots

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Sep 19 22:31:10 UTC 2007


Revision: 1976
          http://rkward.svn.sourceforge.net/rkward/?rev=1976&view=rev
Author:   tfry
Date:     2007-09-19 15:31:09 -0700 (Wed, 19 Sep 2007)

Log Message:
-----------
FOR 0.4.8: Allow specification of different angles/densities per slice in piechart

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/piechart.php
    trunk/rkward/rkward/plugins/plots/piechart.rkh
    trunk/rkward/rkward/plugins/plots/piechart.xml

Modified: trunk/rkward/rkward/plugins/plots/piechart.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.php	2007-09-19 20:41:30 UTC (rev 1975)
+++ trunk/rkward/rkward/plugins/plots/piechart.php	2007-09-19 22:31:09 UTC (rev 1976)
@@ -20,15 +20,21 @@
 	$tabulate= getRK_val ("tabulate")=="TRUE";
 	$radius = getRK_val ("radius");
 	$angle = getRK_val ("angle");
+	$angle_inc = getRK_val ("angle_inc");
 	$density = getRK_val ("density");
+	$density_inc = getRK_val ("density_inc");
 	$col = getRK_val ("colors");
 	$clockwise = getRK_val ("clockwise");
 	$names_mode = getRK_val ("names_mode");
 
 	$options = "";
 	$options .= ", clockwise =" . $clockwise;
-	if ($density >= 0) $options .= ", density =" . $density;
-	$options .= ", angle =" . $angle;
+	if (($density >= 0) || ($density_inc != 0)) $options .= ", density =" . $density;
+	if ($density_inc != 0) $options .= "+ $density_inc * 0:length (x)";
+	if (($density > 0) || $density_inc != 0) {
+		$options .= ", angle =" . $angle;
+		if ($angle_inc != 0) $options .= "+ $angle_inc * 0:length (x)";
+	}
 	if ($radius != 0.8) $options .= ", radius=" . $radius;
 	if ($col == "rainbow") $options .= ", col=rainbow (if(is.matrix(x)) dim(x) else length(x))";
 	else if ($col == "grayscale") $options .= ", col=gray.colors (if(is.matrix(x)) dim(x) else length(x))";

Modified: trunk/rkward/rkward/plugins/plots/piechart.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.rkh	2007-09-19 20:41:30 UTC (rev 1975)
+++ trunk/rkward/rkward/plugins/plots/piechart.rkh	2007-09-19 22:31:09 UTC (rev 1976)
@@ -15,10 +15,12 @@
 		<caption id="tab_options"/>
 		<setting id="colors">Type of colors to use.</setting>
 		<setting id="names_mode">Method for assigning labels to the plot. "default" means, the labels are chosen automatically. If no labels are available, this will generally print the values. The other options allow you to specify the labels as literal string, or as an R statement (e.g. if the names are stored in a different variable in the workspace).</setting>
+		<setting id="clockwise">Define if slices should be drawn clockwise or counter clockwise.</setting>
 		<setting id="radius">Radius of the pie. For long labels it may be necessary to make the pie smaller than the default.</setting>
-		<setting id="angle">Slope of shading lines, given as an angle in degrees (counter-clockwise).</setting>
 		<setting id="density">Density of shading lines (lines per inch). The default value of -1 means no shading lines are drawn.</setting>
-		<setting id="clockwise">Define if slices should be drawn clockwise or counter clockwise.</setting>
+		<setting id="density_inc">The density of shading lines can be varied per pie slice. Set this to values other than 0 to get different densities of shading lines for each slice.</setting>
+		<setting id="angle">Slope of shading lines, given as an angle in degrees (counter-clockwise). This option is only available, if shading lines are drawn, as controlled by the density options above.</setting>
+		<setting id="angle_inc">The slope of shading lines can be varied per pie slice. Set this to values other than 0 to get different slopes of shading lines for each slice. This option is only available, if shading lines are drawn, as controlled by the density options above.</setting>
 		<setting id="plotoptions">Generic plot options. See <link href="rkward://component/plot_options"/>.</setting>	
 	</settings>
 	<related>

Modified: trunk/rkward/rkward/plugins/plots/piechart.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.xml	2007-09-19 20:41:30 UTC (rev 1975)
+++ trunk/rkward/rkward/plugins/plots/piechart.xml	2007-09-19 22:31:09 UTC (rev 1976)
@@ -14,6 +14,10 @@
 		<connect client="names_custom.enabled" governor="custom_names"/>
 		<connect client="names_exp.visible" governor="rexp_names"/>
 		<connect client="names_exp.required" governor="rexp_names"/>
+
+		<convert id="density_0" mode="range" sources="density.real;density_inc.real" max="0"/>
+		<connect client="angle.enabled" governor="density_0.not"/>
+		<connect client="angle_inc.enabled" governor="density_0.not"/>
 	</logic>
 	<dialog label="Pie chart" >
 		<tabbook>
@@ -47,9 +51,16 @@
 				</row>
 				<checkbox id="clockwise" label="clockwise" value="TRUE" value_unchecked="FALSE" checked="false" />
 				<spinbox id="radius" type="real" min="0.01" max="1" initial="0.8" label="Radius"/>
-<!-- TODO: density and angle are a bit pointless, when given as a single option. Rather those should allow to enter/specify a vector! -->
-				<spinbox id="density" type="real" min="-1" max="10000" initial="-1" label="density" default_precision="0"/>
-				<spinbox id="angle" type="real" min="0" initial="45" max="360" label="angle"/>
+				<frame label="Shading">
+					<row>
+						<spinbox id="density" type="real" min="-1" max="10000" initial="-1" label="density" default_precision="0"/>
+						<spinbox id="density_inc" type="real" min="-10000" initial="0" max="10000" default_precision="0" label="increment in density"/>
+					</row>
+					<row>
+						<spinbox id="angle" type="real" min="0" initial="45" max="360" label="angle" default_precision="0"/>
+						<spinbox id="angle_inc" type="real" min="-360" initial="0" max="360" default_precision="0" label="increment in angle"/>
+					</row>
+				</frame>
 				<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options"/>
 			</tab>
 		</tabbook>


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