.:. JSpecView Applet Specification

.:. Description

JSpecView is a viewer for spectral data in the JCAMP-DX format. The program was initially developed at the Department of Chemistry of the University of the West Indies, Mona, Jamaica, WI and is being released via Sourceforge.net Logo under the GNU Lesser General Public License. For a description of version 1 see the article published in Chemistry Central Journal 2007, 1:31 (07Dec2007)
It is written in JAVA and requires at least JAVA 1.7
The code is available under version control (subversion - svn) at http://jspecview.svn.sourceforge.net/viewvc/jspecview/dev2/ An Android version is currently under development and source code is now available on the sourceforge site as well.

applet view
jspecview applet view
application view
jspecview application view

.:. The following example web pages use the outdated version 1 of JSpecView...

Examples of the applet and web page coding:

.:. Features of version 1

* Applets do not normally have permission to write to the hard disk so these functions will not work unless the appropriate permissions are set. An example of a signed JSpecView applet is given in a link to the sample files below. This is not an issue with the standalone application


.:. Parameters

All parameters are passed to the applet as a semi-colon separated list using a script call.
The accepted parameters in the list and their description follows:

.:. Scripting and Live Connect

Certain methods in the applet may be called from JavaScript.
These are:

Method Arguments or Return Values Description
setFilePath for example c:/jcamp-dx/filename.dx or c:\\jcamp-dx\\filename.dx Allows the loading of a new JCAMP-DX file, specified from JavaScript.
Note that the file must be in the class path of the applet or the full path given.
The forward slash can be used as a path separator '/'
or else escape the backslash using a double backslash '\\'.
loadInline string containing JCAMP-DX data Allows the loading of inline JCAMP-DX data, specified from JavaScript string variable.
getCoordinate returns space separated values, e.g. "3220 0.41". Used to return the coordinates of a point when it is clicked on the applet display
toggleGrid none Toggles the grid on/off
toggleCoordinate none Toggles the x,y coordinate display
reversePlot none Reverses the plot
setSpectrumNumber 1, 2, ... For Ntuple and Block files, this specifies the spectrum that should be displayed.
addHighlight x1 - starting x coordinate x2 - ending x coordinate
r - red value of rgb color scheme. Number from 0-255
g - green value b - blue value a - alpha value or transparency.
Number from 0 - 255
Add a highlight to the region specified by x1 and x2
with the color and transparency specified by r, g, b and a.
removeHighlight x1 - starting x coordinate x2 - ending x coordinate Removes the highlight at the position specified by x1 and x2.
There must be a highlight specified by x1 and x2 exactly for this method to work.
removeAllHighlights none Removes all highlights from the display.

JSpecView may call a JavaScript function in response to mouse clicks in the plot area of the spectrum display if the coordcallbackfunctionname parameter (*) is specified. This function gets passed the values of the x and y position as two floating point numbers. Therefore, a JavaScript function must be implemented with the name given by coordcallbackfunctionname and take as its argument two floating point values for the x and y coordinates. Eg. if the value of the coordcallbackfunctionname parameter is onCoordClicked then a JavaScript method might look like this..

function onCoordClicked(x, y){
    alert("You Clicked: " + x + ", " + y);
}

Similarly JSpecView may call a JavaScript function in response to mouse clicks in the plot area of the spectrum display if the peakcallbackfunctionname parameter is specified. As with the coordcallback function this gets passed the values of the x and y position as two floating point numbers. In addition though it returns the closest actual X,Y values from the dataset and the value of the spectrum number if a Block or Ntuple file is open. Therefore, a JavaScript function must be implemented with the name given by peakcallbackfunctionname and take as its argument four floating point values for the two sets of x and y coordinates and an integer for the spectrum number. Eg. if the value of the peakcallbackfunctionname parameter is MyPeakClicked then a JavaScript method might look like this..

function MyPeakClicked(x1, y2, x2, y2, SNum){
    alert("You Clicked: " + x1 + ", " + y1);
    alert("The nearest datapoint was at : " + x2 + ", " + y2);

}

.:.Version 2

See the Google Docs for further information on the new specifications and capabilities.

Examples for version 2 can be found at:
http://wwwwchem.uwimona.edu.jm/spectra/JSpecView2/sample

.:.Version 2 - JavaScript/HTML5 and merged with JSmol

Bob Hanson has fully converted the code to JavaScript/HTML5 and incorporated it into JSmol. Examples for the JavaScript version can be found at:
http://wwwwchem.uwimona.edu.jm/spectra/jsmol/demos and at Bob's site at http://chemapps.stolaf.edu/jmol/jsmol/

Check the JSpecView and the JSmol sourceforge project pages for the latest announcements and sign up to the JSpecView users mailing list to get further information and contribute to the discussion.

To download the latest jar files or source code, visit the Sourceforge Subversion Pages.
Copyright © 2006-2014 by The University of the West Indies, all rights reserved.
Created 1st March 2006. Links checked and/or last modified 21st March 2014.
For further information contact Prof. R.J. Lancashire, Department of Chemistry, UWI, Mona, Kingston 7, JAMAICA, (robert.lancashire@uwimona.edu.jm) or Prof. R.M. Hanson, Department of Chemistry, St. Olaf College,Northfield, MN 55057, USA, (hansonr@stolaf.edu)