[RkWard-devel] avoiding preview "blank out"..

Prasenjit Kapat kapatp at gmail.com
Sun Feb 4 20:52:34 UTC 2007


Ok, before I go to the subject matter, few things first.
> <logic>
> 	[...]
> 	<set id="plotoptions.pointtype.string" to="p">
> 	[...]
> </logic>

Oh, that works! From reading the developer help page, I was under the 
impression that the "to" component was only true/false! My mistake.

> Another thing that is fairly useful during plugin development, is to select
> the .pluginmap files from your working copy in Settings->Configure
> RKWard->Plugins. That way you don't have to make install all the time. Once
> you're done with your modifications, it's still a good idea to test it
> again with the installed files. But while actively modifying the plugins,
> it's a lot easier.

Now, that is much easier, thanks.

> Unfortunately, both is not quite trivial in the current design. The problem
> is, that there are really three different "stages" in the plugins:
> 1) user changes settings in the GUI
> 2) the PHP template is evaluated asynchronously (but typically very near
> real-time)
> 3a) when the user presses submit - or -
> 3b) when the preview code has changed, the generated R code is evaluated,
> again asynchronously (and this may take longer, see below)
> So it would be difficult to feed back results from R commands into the GUI.

So, it is basically a time game. Interesting. Ok, here is the subject matter:

> On Friday 02 February 2007 20:20, Prasenjit Kapat wrote:
> > a) somehow prevent the xlim from being evaluated unless both the
> > entries are valid.
>
> This should be the case in SVN since Thursday. Also, it would probably be a
> good thing to add some sort of status bar to the preview window, so it's
> easier to see, whether the preview is currently up to date, or not. Also,
> probably some checkbox like "keep preview" would be nice.
> Something for after 0.4.6, though.

@Thomas,
Here is a little hack of the plot_options.php file. The goal is to 
avoid "xlim=c(0,max())" (the 0 is just a dummy number to symbolize that 
$xminvalue is not empty) being asynchronously evaluated which causes 
the "blank out" of display in "Preview" mode. Simple: such a situation arises 
only when xvar is absent, so condition it out. Below I am showing only 
relavant parts from the plot_options.php file. Of course, "xlim=c(min(),1)"  
and "xlim=c(a,b)" where a>b type of situation is also taken care of by this 
modification. Again, I am not aware of internal working of either R or 
RKWard, but this simple hack seems to work. Let me know, if I am grossly 
mistaking somethings. And, if this is agreeable then similar change can be 
done for ylimits too.

	if (count ($xvars) > 1) {
		$xvar = "c (" . join (", ", $xvars) . ")";
$noXvar = "0";
	} else {
		$xvar = $xvars[0];
$noXvar = "1";
	}

// the rest of the stuff in between remains same.....

	$xminvalue = getRK_val ("xminvalue");
	$xmaxvalue = getRK_val ("xmaxvalue");
if ($noXvar == "1") {
	if (($xminvalue != "") && ($xmaxvalue != "") && ($xminvalue < $xmaxvalue)) {
		$xlim = ", xlim=c (" . $xminvalue . ", " . $xmaxvalue . ")";
	}
} else {
	$xlim = ", xlim=c (";
	if ($xminvalue == "") $xlim .= "min (" . $xvar . ")";
	else $xlim .= $xminvalue;
	$xlim .= ", ";
	if ($xmaxvalue == "") $xlim .= "max (" . $xvar . ")";
	else $xlim .= $xmaxvalue;
	$xlim .= ")";
}
// Instead of ...
// 	if (($xminvalue != "") || ($xmaxvalue != "")) {
// 		$xlim = ", xlim=c (";
// 		if ($xminvalue == "") $xlim .= "min (" . $xvar . ")";
// 		else $xlim .= $xminvalue;
// 		$xlim .= ", ";
// 		if ($xmaxvalue == "") $xlim .= "max (" . $xvar . ")";
// 		else $xlim .= $xmaxvalue;
// 		$xlim .= ")";
// 	}





More information about the Rkward-devel mailing list