Exporting real-time data and charting in OpenOffice or LibreOffice Calc
I want to connect an RS-2322 port to OpenOffice Calc or LibreOffice Calc. The com port will provide a stream of ASCII numeric characters to OpenOffice Calc. I want OpenOffice Calc to automatically receive and graph the ASCII data, sort of like an oscilloscope. I can control the format of the incoming ASCII data.
- USB HID Logger Professional, Enterprise, or trial version;
- Direct OpenOffice/LibreOffice Connection
It is assumed that:
You've prepared parser items for export.
You can work in OpenOffice Calc or LibreOffice Calc, specifically create charts in Calc.
For this tutorial all items were prepared in the previous part.
Also you may read other examples:
All parser items are now ready for export using the "Direct OpenOffice/LibreOffice Connection" plug-in. Please, open the configuration window of the "Direct OpenOffice/LibreOffice Connection" plug-in (fig.2) by selecting the module in a list (fig. 1, pos. 4) and clicking the "Setup" button on the "Data export" page (fig. 1).
The configuration is very similar to the "Direct Excel Connection" plug-in.
Note: Please, interpret the "Excel" word
on the screenshots and in the program interface as "OpenOffice Calc".
Fig.1. Data export plug-in for OpenOffice Calc.
Fig.2. Charting. OpenOffice Calc connection.
Just select options in the field #1 and the field #2. These options will allow you to start OpenOffice Calc and display it on your desktop. OpenOffice Calc will be started automatically on program start.
Because we want to draw a chart in a real-time environment, then we should prepare an OpenOffice ODS file before the next step. In this example we've created a diagram with 3 plots. Each plot is based on a data from columns A, B or C. We'll place FLOW1, VOLW1 and TEMP1 to columns and the chart will use these values and automatically redraw every time. We'll use last 30 values on the diagram only.
Fig.3. Charting. OpenOffice/LibreOffice file.
The figure above contains following elements:
- Data source for plots in this example;
- OpenOffice worksheet.
The ODS file, which we've created you can download here and use it in your work.
In the next tab, you should specify your workbook options as per your requirements (real-time charting).
Fig.4. OpenOffice Calc. Workbook options.
You should select the "Use a workbook from a file" option (fig.4 pos.1) that allows you to use an existing file and write data to this file. The path and name of this file, which you created before (fig.3), you should specify in the field #2. The option at the pos. 3 allows you to save all the written data when the program exits.
Fig.5. OpenOffice Calc. Worksheet options.
In the next tab, with help of the option at the pos. 3, you should specify your worksheet number in the workbook. We've created the workbook, where the worksheet is first. Therefore we've specified this number on the "Worksheet" page.
Fig.6. OpenOffice Calc. Data format.
The last page "Binding" (fig.7) is very important. On this page the column description and column position that you require to be bound to the variables names are specified.
Fig.7. OpenOffice Calc. Binding.
Any new items may be added by clicking the "Add item" button (Fig.7, pos. 7). Before adding an item the program will ask you about an item description. You can type any characters here, which will help you to remember a variable's content. For this example 3 variables with their corresponding descriptions have been added.
Each data export item has a number of properties:
- Parser item name - is a
parser variable name, which you have created in the parser configuration.
You may select a variable name from a drop-down box or type this name manually;
- Filling mode - data is sent to OpenOffice/LibreOffice Calc in this mode in such a way that if the
number of cells for filling is exceeded, data is moved upwards (if it is filled
by columns) or to the left (if it is filled by rows) and new data is written to
the position that becomes unoccupied after data is moved. Thus, the FIFO filling
method is used. In this example we need last 30 values, therefore we've selected the "Move" method;
- Filling orientation - In this example we need to send data to OpenOffice/LibreOffice Calc , by columns. Therefore we've selected the "Vertically" method;
- Left top cell - here you should specify the coordinates of the upper-left cell starting from which data will be sent to OpenOffice/LibreOffice Calc. The format the coordinates are specified in should comply with the standard accepted in OpenOffice/LibreOffice Calc. For example, a record like A1 will mean the coordinates of the top left cell on the worksheet;
- Cells to fill count - here you can specify the maximum number of cells in a column or in a row that will be filled when data is sent to OpenOffice/LibreOffice Calc.
Click the "OK" button and close the Direct OpenOffice/LibreOffice Connection plug-in configuration
window and the "OK" button in the options window.
Okay, all settings have been completed and we are ready to capture data
to an ODS file.
If the data export module and the parser had been correctly set up, then you should see real-time drawing in OpenOffice/LibreOffice Calc (fig.8).
Fig.8. Charting in OpenOffice Calc
The figure above contains following elements:
- Last 30 values of the parsed data ;
- Diagram with plots.
The ODS file with all values and plots you can download here.
The backup copy of the configuration you may download here (Right click - Save As) and restore it from the "File" menu in the main window.