The list below highlights some of the features of JSpecView, many of which are either new or have been extensively expanded from those available in Chime.
The features
• Load any data file in JCAMP-DX format (with limited support for beta version 6)
• Import AnIML (protocols still in draft form) and CMLspec files.
• Highlight portions of the spectrum.
• Many levels of zooming in and out.
• Print the Spectrum.
• Reverse the plot.
• Display a grid on the spectrum.
• Show the coordinates as the mouse moves over the plot.
• Convert between Absorbance and Transmittance (for UV/Vis and IR)
• Integrate H NMR spectra.
• Four views or interfaces for compound files: single, overlay, tab or tile.
• View the header or properties of the spectrum.
• Javascripting and Live Connect support *
• Export different JCAMP-DX compression formats *
• Export as AnIML, CML, JPG, PNG or SVG *
* Applets do not normally have permission to write to the hard disk so these functions will not work unless the appropriate permissions are set. A self-signed JSpecView applet is available that alleviates this problem and this is not an issue with the standalone application.
Parameters
To simplify the design of web pages that are to be read by different browsers running on different platforms it was decided to initially call a set of JavaScript functions since these can determine the browser type and which version is being used and then apply the appropriate instructions to the applet. The parameters that can be used to change the initial display are passed as a semi-colon separated list using a script call. The allowed parameters in the list and their description follow:
• load To open a spectrum, the name of the JCAMP-DX file must be given. Note that the file must be in the class path of the applet or the full path to the file given.
The forward slash can be used as a path separator '/' or else escape the backslash using a double backslash '\\ '. This is the only parameter that is required.
for example load filename.dx; or load c:/jcamp-dx/filename.dx; or load c:\\ jcamp-dx\\ filename.dx;
• import To import a spectrum stored in AnIML or CML format. Note that the file must be in the class path of the applet or the full path to the file given.
for example import filename.aml; or import c:/XML/filename.aml; or import c:\\ XML\\ filename.aml;
If the extension is .xml the file is interrogated to see what is present in the namespace schema location. This determines whether routines for AnIML or CML are used for reading and parsing the information.
• gridon Specifies whether the grid should be displayed
true or false
• coordinateson Specifies whether the coordinates should be displayed
true or false
• reverseplot Specifies whether the plot should be displayed with scale reversed. (This is the reverse of the order of the points in the file)
true or false
• startindex Used along with endindex to display only a segment of the spectrum. startindex is the index of the starting data point of the segment that should be displayed. If this is specified and endindex isn't, then a segment starting from startindex to the last data point is displayed.
0,1,2,3...
• endindex the index of the last data point of the spectrum to be displayed.
for example 32765
• menuon Specifies whether the menus should be displayed.
If this is set to false then only the Aboutmenu is enabled. This means that zooming is disabled as well.
To enable zoom, set enablezoom true.
• compoundmenuon Specifies whether the menu that enables the user to choose which spectrum to display (in single interface mode) is enabled.
true or false
• enablezoom Specifies whether zooming is enabled. Enabling zoom effectively enables the zoom menu and vice versa.
true or false
• spectrumnumber For Ntuple and Block files, this specifies the spectrum that should be initially displayed when the applet is loaded.
1,2,3...
• interface This parameter applies to Ntuple or Block files only. This changes the GUI (Graphical User Interface) of the applet.
single One spectrum is displayed (default is spectrum number 1). A Ntuple or Block menu is added to the popup menu to navigate to the other spectra in the file.
tab All spectra are displayed and may be navigated with tabs
tile A maximum of 10 spectra are displayed and tiled. If there are more than 10 spectra in the file then the interface defaults to single.
overlay The spectra are displayed overlaid.
single, tab, tile, overlay
• coordcallbackfunctionname a string, e.g. MyCoordCB, default null (see scripting below)
• peakcallbackfunctionname a string, e.g. MyPeakCB, default null (see scripting below)
• titlecolor The color of the title. All Colors must be specified by an rgb value or as a hexadecimal value. eg. black would be "0, 0, 0" or "#000000". Note that the # is required for hexadecimal format and rgb values must be comma separated.
default is black (#000000)
• gridcolor The color of the grid
default is grey (#808080)
• unitscolor The color of the units
default is red (#FF0000)
• scalecolor The color of the scale
default is black (#000000)
• coordinatescolor The color of the coordinates
default is red (#FF0000)
• plotareacolor The color of the plot area
default is white (#FFFFFF)
• plotcolor The color of the plot line
(NB. When spectra are overlaid, the first eight colors are: blue, green, yellow, orange, red, magenta, pink and cyan. After that the colors are chosen at random.)
default is blue (#0000FF)
• backgroundcolor The color of the background
default is grey (#808080)
Scripting and Live Connect
Certain methods in the applet may be called from JavaScript. The following descriptions of the methods and the arguments or return values are given below:
• setFilePath and setXMLPath for example c:/jcamp-dx/filename.dx or c:\\ jcamp-dx\\ filename.xml
Allows the loading of a new JCAMP-DX or importing of a XML 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 '\\ '.
• 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 initially displayed.
addHighlight x1– starting x coordinate, x2– ending x coordinate, r– red value of rgb color scheme, g– green value, b– blue value. Numbers from 0–255. 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 α.
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 or peakcallbackfunctionname parameter is specified. In the first case it gets passed the values of the x and y position as two floating point numbers. In the second case in addition to these values, 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.
The second JavaScript function must be implemented with the name given by the peakcallbackfunctionname parameter 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. For example, 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);
}
From this it is possible to record a series of mouse click positions to generate a peak table list.