Most aspects of a plots appearance can be controlled using commands sent from your Arduino sketch. These methods apply to both Time Plots and XY-Plots. They are included the Arduino Time Plot and XY-Plot library.
Method Summary
The following methods are available to TimePlot
and XYPlot
objects.
- SetTitle(Title)
- SetXLabel(Label)
- SetYLabel(Label)
- SetY2Label(Label)
- SetSeriesProperties(SeriesName, Color, LineStyle, LineWidth, MarkerStyle, AxisOption)
- SetSeriesProperties(SeriesName, SeriesProperties)
- Clear()
- Clear(SeriesName)
- SetYRange(LowerLimit, UpperLimit)
- SetY2Range(LowerLimit, UpperLimit)
- SetYVisible(Visible — optional)
- SetY2Visible(Visible — optional)
- ShowCursor(CursorName, Visible — optional)
- HideCursor(CursorName)
- SetCursorPosition(CursorName, Position, Precision— optional)
Method Descriptions
SetTitle(Title)
Sets the plot title.
1 2 |
MyPlot.SetTitle("Power"); // using ram string MyPlot.SetTitle(F("Power")); // using program memory string. |
SetXLabel(Label)
Sets the label displayed on the plot’s x-axis.
1 |
MyPlot.SetXLabel(F("Time")); |
SetYLabel(Label)
Sets the label displayed on the plot’s left y-axis.
1 |
MyPlot.SetYLabel(F("Voltage")); |
SetY2Label(Label)
Sets the label displayed on the plot’s right y-axis.
1 |
MyPlot.SetY2Label(F("Temperature")); |
SetSeriesProperties(SeriesName, Color, LineStyle, LineWidth, MarkerStyle, AxisOption)
Set the color, line-style, line-width and marker style used for plotting the given series.
1 |
MyPlot.SetSeriesProperties(F("Voltage"), TimePlot::Blue, TimePlot::Solid, 2, TimePlot::Square); |
SetSeriesProperties(SeriesName, SeriesProperties)
Sets one or more of the color, line-style, line-width and marker style used for plotting the given series with a series property string
1 |
MyPlot.SetSeriesProperties(F("Voltage"), F("r:s4")); |
Clear()
Clears all series from the plot.
1 |
MyPlot.Clear(); |
Clear(SeriesName)
Clear the series named SeriesName
from the plot
1 |
MyPlot.Clear("Voltage"); |
SetYRange(LowerLimit, UpperLimit)
Adjusts the Time Plot left y-axis range with the selected limits.
1 |
MyPlot.SetYRange(-100,100); |
SetY2Range(LowerLimit, UpperLimit)
Adjusts the Time Plot right y-axis range with the selected limits.
1 |
MyPlot.SetY2Range(-50,50); |
SetYVisible(Visible)
Hide/show the left y-axis. If Visible
is true
or missing, the axis is shown; if it is false the axis is hidden.
1 2 3 |
MyPlot.SetYVisible(); // show axis MyPlot.SetYVisible(true); // show axis MyPlot.SetYVisible(false); // hide axis |
SetY2Visible(Visible)
Hide/show the right y-axis. If Visible
is true
or missing, the axis is shown; if it is false the axis is hidden.
1 2 3 |
MyPlot.SetY2Visible(); // show axis MyPlot.SetY2Visible(true); // show axis MyPlot.SetY2Visible(false); // hide axis |
ShowCursor(CursorName, Visible — optional)
Show/hide a cursor. If Visible
is true
, or missing, the cursor is shown; if it is false, the cursor is hidden.
1 2 3 |
MyPlot.ShowCursor("Temperature threshold"); // show cursor named 'Temperature threshold' MyPlot.ShowCursor(F("Temperature threshold"), true); // show cursor named 'Temperature threshold' MyPlot.ShowCursor(F("Temperature threshold"), false); // hide cursor named 'Temperature threshold' |
HideCursor(CursorName)
Hide a cursor.
1 2 |
MyPlot.HideCursor("Temperature threshold"); // hide cursor named 'Temperature threshold' MyPlot.HideCursor(F("Temperature threshold")); // hide cursor named 'Temperature threshold' |
SetCursorPosition(CursorName, Position, Precision— optional)
Changes the position of a cursor.
1 2 |
MyPlot.SetCursorPosition("Temperature threshold", 17.3); // move the cursor named 'Temperature threshold' to 17.3 MyPlot.SetCursorPosition(F("Temperature threshold"), 25.2); // move the cursor named 'Temperature threshold' to 25.2 |