The XY Plot visualizer graphs series of X, Y pairs sent from your Arduino to MegunoLink. XY plots are useful to see the relationship between two variables, such as current and voltage passing through a diode, or buffered capture of high-speed data, such as investing the bounce characteristics of a switch.
Data is sent from your Arduino to an XY plot visualizer using the XYPlot
class in our Arduino library.
The xy plot visualizer supports zooming, custom series styles, periodically saving images of the graph using scheduled reporting and exporting graph data to the clipboard or a CSV file.
Creating a XY Plot Visualizer
Select XY Plot from the visualizer menu or toolbox to add a new xy-plot to your project.
You can add as many xy plot visualizers to your MegunoLink project as you like. Send data using message channels in your Arduino sketch to control the data shown on each plot.
Drag the window title tab to organize visualizers in your MegunoLink project.
XY plot visualizer controls can also be added to interface panels.
User Interface
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.
Visualizer Toolbar
Use the tools on the visualizer toolbar to change the content and appearance of the xy-plot.
Tool | Description |
---|---|
Connect/disconnect the selected connection. Use the drop-down to select the connection used by this visualizer. | |
Select the channels processed by the visualizer. | |
Show/hide the series summary table. | |
Show/hide the series legend. | |
Show/hide the cursor panel. | |
Open the plot properties editor to change axis labels and ranges. | |
Open the series property editor for the selected series to change line and marker styles and the axis the series is linked to. | |
Delete all of the series from the plot. | |
Delete the selected series from the plot. | |
Selection tool. Select this tool to pick a series from the plot for editing or deleting. | |
Zoom tool. Select this tool to pick a rectangle on the plot to zoom into. Use the drop-down menu to limit zooming to a horizontal or vertical region, or select a specific time range for the x-axis. | |
Pan tool. Select this tool to drag the view of data plotted. Use the drop-down menu to limit dragging to horizontal or vertical panning. | |
Cursor tool. Select this tool to reposition cursors on the graph. | |
Zoom all. Change the plot axis limits to show all the data. | |
Zoom back. Return to the previous settings of the plot axis limits. | |
Export the plot’s data to an external file, either as an image or tabulated numbers. | |
Export the plot’s data to the clipboard (to paste it into another program, such as Microsoft Excel). Or copy an image of the plot to paste it into a document, such as Microsoft Word. | |
Import series data from a text file into the plot. | |
Open online documentation for the visualizer. |
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:
- Add
#include "MegunoLink.h"
to the top of your Arduino program - Create a
XYPlot
variable - Call
SendData
to 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#include "MegunoLink.h" // Helpful functions for communicating with MegunoLink Pro. // Millis value when the data was last sent. long LastSent; // Interval (milliseconds) between sending analog data const unsigned SendInterval = 200; // [ms] // The plot we are sending data to. XYPlot MyPlot; void setup() { Serial.begin(9600); LastSent = millis(); MyPlot.SetTitle("My Analog Measurement"); MyPlot.SetXlabel("Channel 0"); MyPlot.SetYlabel("Channel 1"); MyPlot.SetSeriesProperties("ADCValue", Plot::Magenta, Plot::Solid, 2, Plot::Square); } void loop() { if ((millis() - LastSent) > SendInterval) { LastSent = millis(); int XDataValue = analogRead(0); int YDataValue = analogRead(1); MyPlot.SendData("ADCValue", XDataValue, YDataValue); } } |