Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-12-2006, 01:23 PM   #1
Registered: Dec 2006
Location: UNM
Distribution: Debian Lenny
Posts: 107

Rep: Reputation: 15
Arrow Rpad - a web interface to identify() ?

View As Web Page

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) {
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.
Old 12-13-2006, 08:07 AM   #2
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
Perhaps you could consider this; chose a language to write your CGI script in, like Python or Perl. Next, see if there are any FastCGI modules/classes/libraries for it (unless you chose something really obscure, there probably will be). Now, in the FastCGI script itself you can start by creating an R process, feeding it what you need and just keeping it open for all requests. You'll have to handle how all the parameters are passed (ex. GET or POST). Now, use Javascript to get the mouse click co-ordinates. With these either (re)load the CGI script or, use AJAX, and let the CGI script handle only the generation of the graph.
Old 12-14-2006, 01:04 PM   #3
Registered: Dec 2006
Location: UNM
Distribution: Debian Lenny
Posts: 107

Original Poster
Rep: Reputation: 15
I would do that, but here's the rest of the setup:

I have an HTML document using the ISMAP argument with the img tag, so the I,J (client-side, image coords) are passed to the server. There, I have a C++ program extracting the I,J from the query string, and need to use identify() in order to get the real X,Y from the image.

The image is thousands of data points graphed out.

I want the user to be able to click on or near a data point, and have the server send them to the HTML page for that data point.

The other thing: the image might change every few minutes, so I can't just create a several MB HTML imagemap.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Firewall Web Interface SolidSnake Linux - Security 2 10-04-2004 08:37 AM
How to make a web interface...? kleptophobiac Programming 3 09-08-2004 04:05 AM
Nagios Web Interface sanfran49 Linux - Software 6 07-15-2003 10:36 AM
cups web interface j-me Linux - Software 3 03-24-2003 01:01 PM
Fetchmail Web Interface RKris Linux - Software 1 03-11-2003 04:23 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration