Skip to content

a web interface to identify()

3 messages · Jon Stearley, Paul Murrell

#
i have a function like this:
  # show a plot and run a script when the user clicks on a plot,
  # where the script arguments correspond to the user-selected point.
  blah <- function(x, y) {
    plot(y~x)
    n <- identify(x=x, y=y)
    com <- system(command=paste("bleh", names(y)[n]))
  }

i would like to do this via a web page instead of x11() etc.  eg:
  1) a user clicks on an image in their web browser
  2) the i,j coordinate is sent to the server
  3) a single R process determines the nearest data point
  4) the server sends a new page to the client, based on attributes  
of the selected data point

i've browsed the R web interface options and frankly don't know which  
to pick, or maybe they are all overkill for what i am trying to  
accomplish?  perhaps the easiest thing to do is use ismap to capture  
the i,j coords, the receiving cgi script connects to an R process for  
the data lookup, and then responds to the browsing client  
appropriately.  the data set involved is very large, so i'd need a  
single R process sitting there waiting for such queries in order to  
avoid initialize&load time - this is the part i am particularly  
unclear how to do.

any ideas/suggestions/guidance on the best approach would be much  
appreciated.  thank you.
#
Hi
Jon Stearley wrote:
Maybe Barry Rowlingson's imagemap is all you need?
http://www.maths.lancs.ac.uk/Software/Imagemap/

Paul
#
On Dec 12, 2006, at 12:58 PM, Paul Murrell wrote:
Thank you for that suggestion.  Unfortunately the plots can involve  
hundreds of thousands of points, and our initial tests with imagemap  
indicated that for this many points it takes too long and generates  
too heavy an html document.  So we are looking for a lighter weight  
solution in order to keep the application responsive.  Current  
thought is to use fifo's between cgi scripts and a single persistent  
R process...

-jon