Scripting
At this section we would like to answer some important questions about scripting in jBEAM.
- 1 Graphs
- 2 Curves
- 2.1 How to create a curve and how to add it to an existing graph?
- 2.2 How to change the color of a curve?
- 2.3 How to change the thickness of a curve?
- 2.4 How to change the fill color of a curve?
- 2.5 How to set colored markers to the curve?
- 2.6 How to change the type of the markers?
- 2.7 How to delete a curve from a graph?
- 3 Channels
- 4 Miscellaneous
- 5 Links
Further pages
Graphs
How to set the size/position of a graph?
You can set the size/position of a graph very easy with the following lines:
// the graph
UniversalCurveGraph u2DGraph = ... // create or get graph
// size values
int graphWidth = 500;
int graphHeight = 400;
// sets position and size
u2DGraph.setScreenBounds(0, 0, graphWidth, graphHeight);
How to make a graph modifyable?
// the graph
UniversalCurveGraph u2DGraph = ...
.
.
.
// makes the graph modifyable in jBEAM
u2DGraph.setModifyable(true);
How to make a graph moveable?
// the graph
UniversalCurveGraph u2DGraph = ...
.
.
.
// makes the graph moveable
u2DGraph.setMoveable(true);
How to make a graph growable/resizeable?
How to make a graph printable?
How to show the legend of a graph?
How to set the name of a graph?
Curves
How to create a curve and how to add it to an existing graph?
If you want to create an new curve and add it to an existing graph, you have to do the following steps:
How to change the color of a curve?
If you want to change the color of your curve, you can easily do this with the following line:
How to change the thickness of a curve?
If you want to change the thickness of your curve, you can easily do this with the following line:
How to change the fill color of a curve?
If you want to change the fill color of your curve, you can easily do this with the following line:
How to set colored markers to the curve?
If you want to set colored markers to your curve, you can easily do this with the following line:
How to change the type of the markers?
If you want to change the type of the markers of a curve, you do this with the following lines:
How to delete a curve from a graph?
If you want to delete an existing curve from a graph, you have to do the following steps.
Use deleteCurve() to delete a specific curve:
Or use removeAllCurves() to delete all existing curves from a graph:
Channels
How to get the channel length of the read data channel?
If you want to get the length of a channel, you can use the following line:
How to get access to individual measured data within a channel?
If you want to get or set an individual valueof a channel, you should use the following ways:
How to get the value for a given time value?
Because jBEAM uses delta x and x-offset to describe the time structure of its channels it is very easy to get a value of any data channel by just providing the time value:
If you use independent channels this can be a little bit trickier:
How to set the DeltaT for QuantumX-measurements?
Because jBEAM-QuantumX measurement module for B-firmware before December 2017 doesn't set DeltaT it can be useful to set DeltaT later during postprocessing. The following script sets the DeltaT for all channels in QuantumX measurement module:
Miscellaneous
jBEAM freezes during executing script
One posibility to prevent this is to activate the Checkbox “Script configures user interface” before launching the script. Activate this option, if the script manipulates the user interface (e.g. buttons, graphical controls, graphs).
Otherwise the script may cause the application to freeze. If the checkbox is selected, the script is executed within the Java UI Thread.
How to start an existing measure automatically over an extern script?
If you want to start a measure automatically by an extern script you have to do the following thing before:
create a project with a measure modul with a trigger (e.g. Adam 6000 with a time trigger)
save the created project
write a batch file, which starts jBEAM with the project and the script as parameter:
write the script you want to run after jBEAM startup:
If you execute the batch file, jBEAM starts and loads the project. After the project is loaded the script runs automatically and starts the measure in the project.
How to start an existing measure automatically over an intern script?
If you want to start a measure automatically by an intern script you have to do the following thing before:
create a project with a measure modul with a trigger (e.g. Adam 6000 with a time trigger)
create a script with the Scripting component editor and save it in your project:
save the created project with the integrated script
write a batch file, which starts jBEAM with the project as parameter:
If you execute the batch file, jBEAM starts and loads the project. After the project is loaded the script in the project runs automatically and starts the measure in the project.
How can I connect to a (SQL-)Database using scripts?
To enable database access you need to provide a special connector library to jBEAM on startup. The library for Mircosoft SQLServers can be downloaded here . Please download and extract the zipfile into the jBEAM-library folder (mostly C:\Program Files\jBEAM\lib or %APPDATA%\jBEAM\lib). jBEAM will now load the database connection library automatically on startup.
To connect and select some data from the database you may use the Java JDBC connection standard API shown in this small example:
Links
In order to learn more about scripting in jBEAM visit the scripting tutorials.