[rkward-cvs] SF.net SVN: rkward:[3778] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Sep 14 17:23:25 UTC 2011


Revision: 3778
          http://rkward.svn.sourceforge.net/rkward/?rev=3778&view=rev
Author:   tfry
Date:     2011-09-14 17:23:25 +0000 (Wed, 14 Sep 2011)
Log Message:
-----------
Also embed tabulation / limitation in dotchart.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugins/plots/barplot.xml
    trunk/rkward/rkward/plugins/plots/dotchart.js
    trunk/rkward/rkward/plugins/plots/dotchart.rkh
    trunk/rkward/rkward/plugins/plots/dotchart.xml

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-09-14 17:16:11 UTC (rev 3777)
+++ trunk/rkward/ChangeLog	2011-09-14 17:23:25 UTC (rev 3778)
@@ -1,3 +1,4 @@
+- More obvious coloring of variable entry fields requiring user input in plugins
 - Default size of the code display in plugin dialogs has been increased			TODO: bump config version enum
 - Added support for RKWard plugins shipped inside R packages 
 - Fixed: PDFs and many other types of documents linked from help pages would not be opened, correctly
@@ -13,7 +14,7 @@
 - Fixed: Potential crash when using context menus with "focus follows mouse" window activation policy
 - Added shortcut Ctrl+Enter to insert a line break and submit from a script editor
 - Reduce CPU usage while idle
-- Pareto-plot plugin gains more tabulation options				TODO: also use in piechart, barplot, dotchart
+- Barplot, dotchart, and Pareto-plot plugins gain more tabulation options				TODO: also use in piechart
 - rk.results() now prints rownames, where appropriate
 - "frame" elements in plugins can now be made checkable
 - Disabling or hiding a plugin component makes it non-required, implicitly
@@ -31,6 +32,7 @@
 - Add "Copy lines to output" action to copy highlighted lines from the R console or script editors to the output window
 - R commands and their output can be "carbon copied" to the output window
 - On Windows, RKWard will detect, and offer to disable "native" file system dialogs
+- 
 - Object browsers that show only the global environment now hide the ".GlobalEnv" item
 - Fixed: Function argument hints would not be shown in some corner cases
 - Added function rk.print.code() to write highlighted R code to the output window

Modified: trunk/rkward/rkward/plugins/plots/barplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.xml	2011-09-14 17:16:11 UTC (rev 3777)
+++ trunk/rkward/rkward/plugins/plots/barplot.xml	2011-09-14 17:23:25 UTC (rev 3778)
@@ -51,15 +51,13 @@
 					<stretch/>
 				</tab>
 				<tab label="Bar labels" id="tab_labels">
-					<frame label="Bar labels">
-						<radio id="names_mode" label="Labeling" >
-							<option value="default" label="Default labels" checked="true"/>
-							<option value="custom" label="Custom labels"/>
-							<option value="rexp" label="From R expression"/>
-						</radio>
-						<input id="names_exp" label="Expression to use for labels" initial="names (x)" required="true"/>
-						<input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label"/>
-					</frame>
+					<radio id="names_mode" label="Bar labels" >
+						<option value="default" label="Default labels" checked="true"/>
+						<option value="custom" label="Custom labels"/>
+						<option value="rexp" label="From R expression"/>
+					</radio>
+					<input id="names_exp" label="Expression to use for labels" initial="names (x)" required="true"/>
+					<input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label"/>
 				</tab>
 				<tab label="Options" id="tab_options">
 					<embed id="barplot_embed" component="rkward::barplot_embed"/>

Modified: trunk/rkward/rkward/plugins/plots/dotchart.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.js	2011-09-14 17:16:11 UTC (rev 3777)
+++ trunk/rkward/rkward/plugins/plots/dotchart.js	2011-09-14 17:23:25 UTC (rev 3778)
@@ -9,32 +9,38 @@
 function doPrintout (full) {
 	var vars = getValue ("x");
 	var names_mode = getValue ("names_mode");
-	var tabulate = getValue ("tabulate");
 
-	var tabulate_header = "";
-	if (tabulate) {
-		tabulate_header = '"Tabulate", "Yes"';
-	} else {
-		tabulate_header = '"Tabulate", "No"';
-	}
+	var tabulate = getValue ("tabulate.checked");
+	var main_header = '"Variable", rk.get.description (' + vars + ')';
+	if (tabulate) main_header = getValue ('tabulate_options.parameters');
 
+	var limit = getValue ("limit.checked");
+	var limit_header = "";
+	if (limit) limit_header = ", " + getValue ('limit_options.parameters');
+
 	var options = getValue ("plotoptions.code.printout");
 
 	var plotpre = getValue ("plotoptions.code.preprocess");
 	var plotpost = getValue ("plotoptions.code.calculate");
 
 	if (tabulate) {
-		echo ('x <- table (' + vars + ', exclude=NULL)\n');
+		echo (getValue ('tabulate_options.code.calculate'));
+		echo ('x <- as.numeric (x)		# dotchart() is somewhat picky about data type\n');
 	} else {
-		echo ('x <- ' + vars);
-		echo ('\n');
+		echo ('x <- ' + getValue ("x") + '\n');
+		echo ('title <- rk.get.description (' + getValue ("x") + ')\n');
 		echo ('if (!is.numeric (x)) {\n');
-		echo ('	warning ("Data may not be numeric, but proceeding as requested.\\nDid you forget to check the tabulate option?")\n');
+		echo ('	warning ("Data is not numeric, but proceeding as requested.\\nDid you forget to check the tabulate option?")\n');
 		echo ('}\n');
 	}
+
+	if (getValue ("limit.checked")) {
+		echo (getValue ('limit_options.code.calculate'));
+	}
 	echo ('\n');
+
 	if (full) {
-		echo ('rk.header ("Dot chart", parameters=list ("Variable", rk.get.description (' + vars + '), ' + tabulate_header + '))\n');
+		echo ('rk.header ("Dot chart", parameters=list (' + main_header + limit_header + '))\n');
 		echo ('\n');
 		echo ('rk.graph.on ()\n');
 	}

Modified: trunk/rkward/rkward/plugins/plots/dotchart.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.rkh	2011-09-14 17:16:11 UTC (rev 3777)
+++ trunk/rkward/rkward/plugins/plots/dotchart.rkh	2011-09-14 17:23:25 UTC (rev 3778)
@@ -10,8 +10,13 @@
 
 	<settings>
 		<caption id="tab_variables"/>
-		<setting id="x">Matrix, vector or a factor. Data needs to be numeric unless the tabulate option is checked, below.</setting>
-		<setting id="tabulate">Use tabulate option mainly for factor variables or wherever else applicable.</setting>
+		<setting id="tabulate">If your data needs to be tabulated / aggregated before plotting, check this option. Refer to <link href="rkward://component/one_var_tabulation"/> for details on the dependent options.</setting>
+		<setting id="x">If your data is already suitable for plotting, directly, specify it here. Otherwise, leave this empty, and check the "Tabulate" option, above.</setting>
+
+		<caption id="tab_limit_options"/>
+		<setting id="limit">If there are very many categories in your data, it may make sense to limit the amount of categories that will be displayed. Check this, if you want to set a limit. See Refer to <link href="rkward://component/limit_vector_length"/> for details on the dependent options.</setting>
+
+		<caption id="tab_labels"/>
 		<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>
 		<caption id="tab_options"/>
 		<setting id="plotoptions">Generic plot options. See <link href="rkward://component/plot_options"/>.</setting>	
@@ -21,7 +26,7 @@
 			<li><link href="rkward://component/barplot"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
 			<li><link href="rkward://rhelp/dotchart"/></li>
-			<li><link href="rkward://rhelp/table"/></li>
+			<li><link href="rkward://component/one_var_tabulation"/></li>
 		</ul>
 	</related>
 </document>

Modified: trunk/rkward/rkward/plugins/plots/dotchart.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.xml	2011-09-14 17:16:11 UTC (rev 3777)
+++ trunk/rkward/rkward/plugins/plots/dotchart.xml	2011-09-14 17:23:25 UTC (rev 3778)
@@ -8,11 +8,28 @@
 		<connect client="names_custom.visible" governor="rexp_names.not"/>
 		<connect client="names_custom.enabled" governor="custom_names"/>
 		<connect client="names_exp.visible" governor="rexp_names"/>
-		<connect client="names_exp.required" governor="rexp_names"/>
-		
+
 		<set id="plotoptions.allow_ylim" to="false"/>
 		<set id="plotoptions.allow_log" to="false"/>
 		<set id="plotoptions.allow_type" to="false"/>
+
+		<connect client="x.enabled" governor="tabulate.checked.not"/>
+		<connect client="tabulate_options.varsource.selected" governor="vars.selected" />
+
+		<script><![CDATA[
+			gui.addChangeCommand ("tabulate.checked", "updateFunLabel ()");
+			gui.addChangeCommand ("tabulate_options.fun_label", "updateFunLabel ()");
+			updateFunLabel = function () {
+				if (gui.getValue ("tabulate.checked")) {
+					gui.setValue ("plotoptions.default_xlab", gui.getValue ("tabulate_options.fun_label"));
+					gui.setValue ("plotoptions.default_ylab", "title");
+				} else {
+					gui.setValue ("plotoptions.default_xlab", "");
+					gui.setValue ("plotoptions.default_ylab", "");
+				}
+			}
+			updateFunLabel ();
+		]]></script>
 	</logic>
 	<dialog label="Dot chart" >
 		<tabbook>
@@ -20,25 +37,34 @@
 				<row>
 					<varselector id="vars"/>
 					<column>
-					<varslot min_vars="1" id="x" source="vars" required="true" label="Variable"/>
-					<checkbox id="tabulate" label="Tabulate" value="1" value_unchecked="0" checked="false" />
-					<frame label="Labels">
-						<radio id="names_mode" label="Labeling" >
-							<option value="default" label="Default labels" checked="true"/>
-							<option value="custom" label="Custom labels"/>
-							<option value="rexp" label="From R expression"/>
-						</radio>
-						<input id="names_exp" label="Expression to use for labels" initial="names (x)"/>
-						<input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label"/>
-					</frame>
-					<stretch/>
-					<preview id="preview"/>
+						<frame id="tabulate" label="Tabulate data before plotting" checkable="true" checked="false">
+							<embed id="tabulate_options" component="rkward::one_var_tabulation" as_button="false" label="Tabulation Options"/>
+						</frame>
+						<varslot min_vars="1" id="x" source="vars" required="true" label="Variable"/>
+						<stretch/>
+						<preview id="preview"/>
 					</column>
 				</row>
 			</tab>
+			<tab label="Limit" id="tab_limit_options">
+				<frame id="limit" label="Limit number of groups" checkable="true" checked="false">
+					<embed id="limit_options" component="rkward::limit_vector_length" as_button="false" label="Limit Categories"/>
+				</frame>
+				<stretch/>
+			</tab>
+			<tab label="Labels" id="tab_labels">
+				<radio id="names_mode" label="Labels" >
+					<option value="default" label="Default labels" checked="true"/>
+					<option value="custom" label="Custom labels"/>
+					<option value="rexp" label="From R expression"/>
+				</radio>
+				<input id="names_exp" label="Expression to use for labels" initial="names (x)" required="true"/>
+				<input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label"/>
+				<stretch/>
+			</tab>
 			<tab label="Options" id="tab_options">
+				<embed id="plotoptions" component="rkward::plot_options" as_button="false" label="Plot Options"/>
 				<stretch/>
-				<embed id="plotoptions" component="rkward::plot_options" as_button="false" label="Plot Options"/>
 			</tab>
 		</tabbook>
 	</dialog>

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