Chart

Line, bar or scatter series against one or two Y axes, with a rolling window. The chart is involved enough to have its own page; the settings are summarised here.

Group: Visualiser · Default size: 240 × 160 · Style parts: Main, Scrollbar, Items, Indicator, Ticks

A dropped Chart: a line of ten blue points rising from left to right, with numbers 0 to 100 up the left and 0 to 4 along the bottom.
A Chart as it is dropped, with its one series of example values.
The first of the Chart settings: Chart type Line, Number of points 10, Point size 7, division lines, zoom, the primary Y range 0 to 100, Secondary Y axis, When full, Rolling window and the tick settings.
The first of its settings.
SettingDefaultWhat it does
Chart typeLineLine, Bar, Scatter or None.
Number of points10Points per series. On the device this is the window length in points.
Point size7The dot on each point of a line or scatter chart, in pixels. 0 draws the line alone.
Division line count X / Y3 / 5Grid lines.
Zoom X / Y256256 is 100%.
Primary Y range min / max0 / 100The left axis.
Secondary Y axisoffAdds a right-hand axis with its own range; each series chooses which it is measured against.
X range min / max, X fromscatter onlyThe X axis range, and the variable every point takes its X from.
When fullShiftShift scrolls left; Circular overwrites from the start.
Rolling windowThe last N pointsOr a span of time in seconds, in which case the firmware paces readings to fit the point count.
Ticks and labelsvariousMajor and minor tick length and count, whether to label the X and Y axes, and the axis font size. The X axis can have tick counts of its own, and on a line or bar chart you choose what its numbers read: the ticks counted from 0, the point numbers, or a range.
Chart dataone seriesThe series: each has a name, a colour, design-time values and - once a second axis exists - which axis it uses.

Example: the light level from the board’s light sensor

The Cheap Yellow Display has a light sensor on GPIO 34. The board reads it as an analog input, a variable holds the reading, and the chart is given each one.

  1. Open the Hardware tab, then I/O. In Analog inputs press + (Add analog input), name it Light and set Pin to 34. Its scaling turns the 0-4095 it reads into 0-100.
  2. On the Data tab add a Float variable called light and set its Source to Light, in the Analog inputs group.
  3. Drag a Chart onto the screen, name it LightChart and give it X 30, Y 20, Width 270 and Height 190. Under Chart data name its series Light.
  4. Open Data bindings and press Add binding: Variable light, Drives Push onto chart, Series Light.
  5. Press Preview. In the drawer beside the screen, under Simulated inputs, move Light: the reading is put on the end of the line. On the board a point is added at each reading, and the oldest drops off the left.
Preview: the light chart, its line ending in a point at about 80.
A simulated reading of 80, pushed onto the line.
The preview drawer's Simulated inputs section with a slider for Light at 80.
The reading Preview stands in for.
Hardware, I/O, Analog inputs: an input called Light on pin 34 (in-only), attenuation 11 dB, scaling raw 0 to 4095 into 0 to 100.
The light sensor as an analog input.
The chart's Data bindings: Variable light, Drives Push onto chart, Series Light.
Each reading is pushed onto the series.