MegunoLink Pro gets information for plotting data from specially formatted commands in serial streams. Each command must be surrounded by braces (‘{‘ and ‘}’). Any text that is not within braces is ignored by the MegunoLink Pro plot handler.

The general format of plot messages is: {PLOTTYPE:channel-name|command|command data}

  • The PLOTTYPE parameter is required. It sets the type of plot that the message is for and may be either TIMEPLOT or XYPLOT
  • The :channel-name parameter is optional. It sets the plotting channel.
  • The command parameter is required and sets the action that will be taken by MegunoLink Pro. Supported commands include: SET, DATA, DATA-STEP, D, DS, CLEAR. Commands are described in more detail below
  • command data is the data used by the commands. Not all commands require data

Examples

  • {TIMEPLOT|data|My series name|T|23}: adds the value 23 to a series named “My series name” on all time-plots
  • {TIMEPLOT:Battery|data|Voltage|T|12.2}: adds the value 12.2 to a series named “Voltage” on time-plots with the channel named “Battery” selected
  • {TIMEPLOT:Battery|data|Current:r-2s2|T|0.12} : adds the value 0.12 to a series named “Current” on time-plots with the channel named “Battery” selected. The series is shown using a 2 pixel thick red, dashed line with square markers of size 2.

Plot Type and Channel

MegunoLink Pro currently supports two plot types: time-plots and xy-plots. The x-axis of a time plot is time, while the x-axis of an xy-plot is a number. Time-plots can pan automatically to show the current time on the x-axis, much like an old chart recorder. XY-plots remain stationary. The plot type is the first part of the message and may be TIMEPLOT or XYPLOT.

The plot type is optionally followed by a channel, with the plot type and channel separated by a colon (:). Channels group series together and allow several plots of the same time in a single project with each channel appearing on a different plot. Channel names can include any characters except colon, pipe and closing brace ( :, |, } ). Channel names should be 15 characters or less.

The plot type and channel (if required) must be included in all plot messages.

Examples

  • {TIMEPLOT|DATA|My series name|T|23}: sending data to the default time-plot channel
  • {TIMEPLOT:Battery|DATA|Voltage|T|12.2}: sending data to the Battery time-plot channel
  • {XYPLOT:Waveform|SET|TITLE=Measured Waveform} : set the title of an xy-plot displaying the Waveform channel

Sending Data to Plots

There are two commands to send data to plots: DATA and DATA-STEP. They can be abbreviated to D and DS, respectively. Both require a series name and a set of data, which is added to the plot. The series name and data values should all be separated by ‘|’ characters. For example: {XYPLOT|DATA|Series|1|12.3|2|15.3|3|11.2}.

A series names the collections which MegunoLink Pro adds data to as the data is received from the serial stream. Each series is plotted on the graph with all points (optionally) connected by a line and having the same marker style and colour. By using different series names, ‘Voltage’ and ‘Current’, for example, you can plot multiple sets of data on a single plot. Series properties can be specified after the series name, but they are not required. When series properties are included, they override the current plot setting in MegunoLink Pro.

The data-values for the DATA (or D) command is a list of x-y pairs, each separated by a ‘|’ character. For example: {XYPLOT|DATA|SeriesName|1|12.3|2|15.3|3|11.2} would add the values (1,12.3), (2,15.3), (3, 11.2) to an x-y plot.

When sending data to a TIMEPLOT, the x-value may be replaced by a ‘T’ to use the computer’s current time for the x-value.

The data-values for the DATA-STEP (or DS) command is an x-value (x0), a step size (Δx) and a sequence of y-values. The x-value for the ith y-value is calculated from:
xi = x0 + Δx × i
If x0 = ‘T’, the step size is given in seconds. Otherwise, it is in the same units as x. For example:
{TIMEPLOT|DATA-STEP|SeriesName|T|60|12.3|15.3|11.2}
would add the values (T, 12.3), (T + 60 seconds, 15.3), (T + 120 seconds,11.2) to a time plot, where T represents the current computer time when the message was received.

You can specify the time used on the TIMEPLOT’s x-axis using one of the following formats:

  • yyyy-MM-dd H:mm:ss
  • yyyy-MM-dd H:mm
  • yyyy-MM-dd H:mm:ss.FFF
  • yyyy-MM-dd
  • H:mm:ss
  • H:mm
  • H:mm:ss.FFF

Where:

  • yyyy is a four digit year, such as 2015
  • MM is a two digit month between 01 and 12
  • dd is a two digit day between 01 and 31
  • H is the hour part of the time between 0 and 23
  • mm is the minute part of time between 00 and 59
  • ss is the second part of time between 00 and 59
  • FFF is millisecond part of time between 000 and 999

Clearing Plot Data

Data from all series on a plot can be cleared by sending a clear command. The clear command takes no parameters.

  • {TIMEPLOT|CLEAR}: clears all data from a time plot
  • {XYPLOT:Power|CLEAR}: clears all data from xy-plots showing the Power channel

Adjusting Plot Limits

The limits for plots can be adjusted using the following commands.

  • {TIMEPLOT|xrange|T|6.0}: sets the x-range for a timeplot to have a span of 6 hours from the current time.
  • {TIMEPLOT|yrange|-100|20}: sets the y-range for a timeplot to have a span from -100 to 20.
  • {XYPLOT:Power|xrange|-10|10}: sets the x-range for an xyplot (with channel name Power) to have a span from -10 to 10.

Plot Properties

Plot properties include axis and plot titles. The command for setting plot properties is SET. The property name and value are specified on the command data, separated by ‘=’.

The properties available are:

Plot properties that can be set using serial commands.
Property Name Description
title Set the plot title.
x-label Set the label for the x-axis.
y-label Set the label for the left y-axis.
y2-label Set the label for the right y-axis.
y-visible Hide/show the left y-axis. Value of 0 hides; value of 1 shows.
y2-visible Hide/show the left y-axis. Value of 0 hides; value of 1 shows.

Examples

  • {TIMEPLOT|SET|Title=My Title}: set the title of a time plot to My Title
  • {TIMEPLOT|SET|X-Label=Time}: set the x-axis (horizontal) label of a time plot to Time
  • {XYPLOT|SET|Y-Label=Voltage}: set the y-axis (vertical) label of an xy-plot to Voltage
  • {XYPLOT|SET|Y2-Visible=1}: show the right y-axis

Series Properties

Series properties include the colour, line-style, marker type and marker size used for drawing series on the plot. Series properties can be included with data messages or set separately. Including the series properties with a data message means the series formatting will be available even if MegunoLink was not connected to the device when formatting was set, however it does make the messages a little longer.

Series properties can be set using the STYLE command: {TIMEPLOT|STYLE|Series name:PropertyString}, where PropertyString defines the style values.

Series properties can be sent with a data command by including the property after the series name: {XYPLOT|DATA|Series name:PropertyString|22|0.12}. Again, PropertyString defines the style values.

Start typing and press Enter to search