Our XY Plot visualizer lets you send x,y pairs through your microcontroller’s serial port to view plots of the data.
To create a new x-y plot, select the X-Y visualizer from the Visualizers panel. Click the Visualizer icon on the main toolbar to show the Visualizers panel.
- Arduino XYPlot library reference: for details on plotting data using our Arduino Library
- Raw plotting message reference: for details on the raw message format for sending data to MegunoLink Pro for plotting. It is usually easier to use the Arduino library than creating raw messages if you are on the Arduino platform.
Sending Data from an Arduino
We’ve created an Arduino library to make it easier to send data to MegunoLink Pro for plotting. After you install the Arduino library:
#include "MegunoLink.h"to the top of your Arduino program
- Create a
SendDatato send data to MegunoLink Pro for plotting
This simple example sets the graph titles and plots points using analog channel 0 for the x-axis and analog channel 1 for the y-axis.
#include "MegunoLink.h" // Helpful functions for communicating with MegunoLink Pro.
// Millis value when the data was last sent.
// Interval (milliseconds) between sending analog data
const unsigned SendInterval = 200; // [ms]
// The plot we are sending data to.
LastSent = millis();
MyPlot.SetTitle("My Analog Measurement");
MyPlot.SetSeriesProperties("ADCValue", Plot::Magenta, Plot::Solid, 2, Plot::Square);
if ((millis() - LastSent) > SendInterval)
LastSent = millis();
int XDataValue = analogRead(0);
int YDataValue = analogRead(1);
MyPlot.SendData("ADCValue", XDataValue, YDataValue);
MegunoLink Pro plots support channels, a short text string for grouping series together. Channels let you have several plots in a project, sending different data to each.
Refer to the Arduino Library documentation and the message format reference for more information on setting up channels in your microcontroller.
Use the channel selector on the plot toolbar to choose which channel the plot should show. The channel selector is automatically populated with channels as they are detected. You can also type a channel name directly into the selector’s text box.
Plot properties and series styles can be set using buttons on the plot toolbar. Along with tools to select and remove series, zoom and pan, you can also hide or show the plot legend and toggle visibility of the summary table. The summary table lists the series which have been detected along with useful statistics including the minimum, maximum and average value received for each series.