This page describes the functions and methods supported by the TimePlot class for sending data, setting properties and controlling the Time Plot visualizer from your Arduino sketch.

The TimePlot visualizer shows numerical data on a graph with time as the x-axis. Your computer’s time is used to time-stamp each value received from your Arduino sketch. Custom time strings can be sent using the raw message format.

Data is grouped in series for plotting. The series are identified with a Series Name and new values are appended to the series and shown on the plot as they arrive. You can assign different marker, line and axes to each series.

By default, all the data sent for plotting is shown in the visualizer. You can create multiple plots and control which data is shown on each using message channels. To use channels, supply a channel name in the TimePlot constructor.

You will need to install our Arduino Library for MegunoLink to use the TimePlot class.

Check out our Plotting Data guide for an introduction to plotting with MegunoLink.

Methods

The following methods are specific to Time Plots:

The following methods, common to all plot visualizers, can be used to control the plot’s appearance:

Detailed Descriptions

The parameters and functions for Time Plot methods are given. Optional parameters are surrounded by []‘s. Text parameters support memory strings and flash strings (where available).

Time Plot Constructor

Constructs a time plot variable, which can be used to send data, format and control Time Plot visualizers.
TimePlot([ChannelName], [Destination])

Parameters
NameTypeRequired?Description
ChannelNameTextNosets the channel used for all methods called on the variable. If missing, data is sent to the default channel
DestinationPrintNothe stream used for all methods called on the variable. If missing, data is sent to the standard Serial port

Sending Data

Methods to send numeric data to a Time Plot visualizer. Select a function based on the parameters you want to supply.

Parameters
NameTypeRequired?Description
SeriesNameTextYesThe name of the series the data belongs to. A series is a collection of points, optionally connected by a line.
YValueNumberYesThe y-value to add to the plot for SeriesName
SeriesPropertiesTextNoA series property string to set the series style
ColorPlot::ColorsYesOne of the supported color constants to set the series line and marker color
LineStylePlot::LineStyleNoOne of the supported line-style constants to set the series line style. Defaults to Plot::Solid
LineWidthNumberNoThe thickness to draw the series line. Defaults to 1
MarkerStylePlot::MarkerStyleNoOne of the supported marker-style constants to set the series marker style. Defaults to Plot::Circle
AxisOptionPlot::AxisOptionNoOne of the supported axis option constants to set which axis the series is linked to. Defaults to Plot::DefaultAxis, which doesn’t change the axis the series is linked to
DecimalPlacesNumberYesThe precision to use when sending floating-point numbers.

X-Axis Limits

Change the time-span shown on the plot’s x-axis.
SetXRange(TimespanHours)

Auto Scroll behaviour

Enable/disable the Time-Plot’s auto-scroll behavior. When auto-scroll is enabled, older data scrolls off the left edge of the chart. Data is not lost; zoom or pan to see data that has scrolled out of view.

  • Run([Enable]): when Enable is true or missing, turns on auto-scroll; if false, auto-scroll is disabled.
  • Stop(): stop auto-scroll; stops the plot from panning automatically.

Example

This example sends the current voltage on analog channel 0 to MegunoLink Pro every 200 ms.

More Information

For more information on plotting and formatting see:

Start typing and press Enter to search