Charts
Signals and time series
Channels over time, their spectra, process control and live panels.
Each chart below is drawn live from the data of its example. All kinds: Chart types.
Multi-band
A Multi-band chart drawn by the engine from the data of the example below.
The main time-series chart: channels against the worksheet X axis (usually time), each with its own Y scale, overlaid or stacked in bands. It is the chart live streams draw into, and the one that shares its cursor with the others.
Data. Numeric columns, one of them the X key of the worksheet (time, distance, phase…). Any number of rows: large files are decimated per viewport.
Example
// t, speed, rpm, throttle: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Run 12',
columns: { t, speed, rpm, throttle },
units: { t: 's', speed: 'km/h', rpm: 'rpm', throttle: '%' },
})
engine.worksheets.setXKey(engine.getState().activeWorksheetId, 't')
const chart = engine.charts.add('multiband', {
title: 'Run 12',
settings: {
layout: 'parallel',
series: [
{
id: 's-speed',
column: 'speed',
color: '#f5a524',
bandFromPct: 67,
bandToPct: 100,
scaleMin: 40,
scaleMax: 200,
yMajorStep: 0,
yMinorStep: 0,
},
{
id: 's-rpm',
column: 'rpm',
color: '#38bdf8',
bandFromPct: 34,
bandToPct: 66,
scaleMin: 0,
scaleMax: 8000,
yMajorStep: 0,
yMinorStep: 0,
},
{
id: 's-throttle',
column: 'throttle',
color: '#22c55e',
bandFromPct: 0,
bandToPct: 33,
scaleMin: 0,
scaleMax: 100,
yMajorStep: 0,
yMinorStep: 0,
},
],
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
series | PlotSeries[]Default: [] | The channels: { id, column, color, bandFromPct, bandToPct (the band, % from the bottom), scaleMin, scaleMax, yMajorStep, yMinorStep (0 = automatic), alarm? }. charts.addSeries adds one with a fitted scale. |
layout | 'overlay' | 'parallel'Default: 'overlay' | 'overlay' draws every series over the whole plot; 'parallel' gives each its own band. |
lineWidth | numberDefault: 1 | Trace width in px. |
xAxisLine | AxisLineStyleDefault: solid | { style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }. |
yAxisLine | AxisLineStyleDefault: solid | { style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }. |
gridLine | AxisLineStyleDefault: dotted | Grid lines, same shape as the axis lines. |
beacon | BeaconSettingsDefault: off | { enabled, reference: "dataset" | "previous" | "none", datasetId, datasetColor, previousColor }: one live cycle at a time (X starting over) against reference data. |
addColumn | stringDefault: first numeric column | The column the settings dialog offers to add next. |
envelope | booleanDefault: false | Shade the band of a reference (columns added with bands) under each series. |
- Every other chart of the worksheet follows the cursor you move over a multi-band chart.
- Live: the chart follows the newest sample and the wheel resizes the window (view.setLiveWindow).
Area Chart
A Area Chart chart drawn by the engine from the data of the example below.
Filled areas of several columns over an X column, stacked to show how parts add up to a total (energy sources, load per line, queue by state).
Data. An X column and one or more value columns, sorted by X.
Example
// hour, solar, wind, grid: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Energy mix',
columns: { hour, solar, wind, grid },
units: { hour: 'h', solar: 'MW', wind: 'MW', grid: 'MW' },
})
const chart = engine.charts.add('areachart', {
title: 'Energy mix',
settings: {
acXCol: 'hour',
acYCols: ['grid', 'wind', 'solar'],
acStacked: true,
acAlarm: { value: 120, style: 'dashed', width: 1.5, color: '#f87171' },
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
acXCol | stringDefault: '' | Column along X. |
acYCols | string[]Default: [] | Columns drawn as areas, bottom first when stacked. |
acStacked | booleanDefault: false | Stack the areas instead of overlaying them. |
acYScale | { scaleMin, scaleMax }Default: '' / '' | Fixed value axis as strings; '' is automatic. |
acAlarm | AlarmLine | nullDefault: null | Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none. |
Spectrum
A Spectrum chart drawn by the engine from the data of the example below.
The FFT of one signal: which frequencies it contains and how strong they are. For vibration, acoustics and electrical harmonics.
Data. One signal column sampled at a constant rate. The rate comes from a time column or from specSampleRate.
Example
// accel: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Gearbox',
columns: { accel },
units: { accel: 'g' },
})
const chart = engine.charts.add('spectrum', {
title: 'Gearbox vibration',
settings: {
specSignalCol: 'accel',
specSampleRate: '2000',
specYMode: 'amplitude',
specColor: '#38bdf8',
specAlarm: { value: 0.5, style: 'dashed', width: 1.5, color: '#f87171' },
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
specSignalCol | stringDefault: '' | Signal to transform. |
specTimeCol | stringDefault: '' | Time column: the rate is its sample count over its span. '' uses specSampleRate. |
specSampleRate | stringDefault: '1000' | Sample rate in Hz, used when specTimeCol is empty. |
specXMode | 'hz' | 'order'Default: 'hz' | Frequency in Hz, or in orders of a rotating speed. |
specYMode | 'amplitude' | 'db'Default: 'amplitude' | Linear amplitude or decibels. |
specWindow | 'hann' | 'rectangular'Default: 'hann' | Window applied before the FFT. |
specLogX | booleanDefault: false | Logarithmic frequency axis. |
specColor | stringDefault: #34d399 | Colour of the marks (hex). |
specAlarm | AlarmLine | nullDefault: null | Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none. |
Spectrogram
A Spectrogram chart drawn by the engine from the data of the example below.
A short-time FFT: how the spectrum changes over time, as a colour map or a 3-D waterfall. Shows run-ups, resonances and orders that move with speed.
Data. One signal column at a constant rate, long enough for many FFT windows.
Example
// accel: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Run-up',
columns: { accel },
units: { accel: 'g' },
})
const chart = engine.charts.add('spectrogram', {
title: 'Run-up',
settings: {
sgSignalCol: 'accel',
sgSampleRate: '4000',
sgWindowSize: 512,
sgOverlap: 0.75,
sgYMode: 'db',
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
sgSignalCol | stringDefault: '' | Signal to transform. |
sgTimeCol | stringDefault: '' | Time column for the rate; '' uses sgSampleRate. |
sgSampleRate | stringDefault: '1000' | Sample rate in Hz, used when sgTimeCol is empty. |
sgWindowSize | numberDefault: 512 | FFT window in samples, a power of two. Larger: finer frequency, coarser time. |
sgOverlap | numberDefault: 0.5 | Overlap between windows, 0 to 0.95. |
sgWinFunc | 'hann' | 'rectangular'Default: 'hann' | Window function. |
sgYMode | 'amplitude' | 'db'Default: 'db' | Colour by linear amplitude or decibels. |
sgLogFreq | booleanDefault: false | Logarithmic frequency axis (2-D map only). |
sgView | '2d' | 'waterfall'Default: '2d' | 'waterfall' draws time, frequency and level as a 3-D surface. |
Control Chart
A Control Chart chart drawn by the engine from the data of the example below.
Statistical process control: values in order with their mean and control limits, so a drift or an out-of-control point stands out.
Data. One value column in production order; optionally a subgroup column (X̄-R chart).
Example
// weight: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Fill weight',
columns: { weight },
units: { weight: 'g' },
})
const chart = engine.charts.add('controlchart', {
title: 'Fill weight',
settings: { ccValueCol: 'weight', ccSigmaLevel: 3, ccColor: '#22d3ee' },
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
ccValueCol | stringDefault: '' | Measured value. |
ccSubgroupCol | stringDefault: '' | Subgroup column for X̄-R; '' plots individuals (I-MR). |
ccSigmaLevel | numberDefault: 3 | Control limits at this many sigma. |
ccColor | stringDefault: #22d3ee | Colour of the marks (hex). |
Gauges
A Gauges chart drawn by the engine from the data of the example below.
Dials and bars for the current value of a few channels: a control-room panel next to the trends. Over a live stream they show the latest sample.
Data. Numeric columns; each gauge reads the last, mean, minimum or maximum of one.
Example
// t, pressure, temp, level: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Unit 2',
columns: { t, pressure, temp, level },
units: { pressure: 'MPa', temp: '°C', level: '%' },
})
const chart = engine.charts.add('gauge', {
title: 'Panel',
settings: {
ggGauges: [
{
id: 'g-pressure',
column: 'pressure',
color: '#f5a524',
value: 'last',
style: 'arc',
min: '14',
max: '18',
alarm: { value: 16.4, style: 'solid', width: 2, color: '#f87171' },
colorMode: 'zones',
stops: [
{ at: 14, color: '#22c55e' },
{ at: 16, color: '#facc15' },
{ at: 16.4, color: '#f87171' },
],
},
{
id: 'g-temp',
column: 'temp',
color: '#fb923c',
value: 'last',
style: 'arc',
min: '280',
max: '305',
},
{
id: 'g-level',
column: 'level',
color: '#22c55e',
value: 'last',
style: 'linear',
min: '0',
max: '100',
},
],
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
ggGauges | GaugeItem[]Default: [] | The gauges in order: { id, column, color, value: 'last' | 'mean' | 'min' | 'max', style: 'arc' | 'linear', min, max ('' = the data's range), fill?: 'min' | 'zero', alarm?, colorMode?: 'solid' | 'gradient' | 'zones', stops?: { at, color }[] }. newGaugeItem(column, index) and presetStops(...) build them. |
Camera
Video of a camera next to its data: live while the worksheet follows live, or the recorded frame at the chart cursor when you review a cloud recording.
Data. No columns: a camera of a live data stream (see Cameras). Up to 9 cameras make a wall.
Example
// A camera of a live data stream (see Cameras): its id comes from engine.live.
const chart = engine.charts.add('camera', {
title: 'Bench camera',
settings: { cameraStreamId: 'cam-…', fit: 'contain' },
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
cameraStreamId | stringDefault: '' | The camera's live connection id. |
cameras | string[]Default: [] | Up to 9 camera ids in order (cameras[0] = cameraStreamId); two or more draw a wall. |
syncStreamId | stringDefault: '' | Stream whose clock maps the cursor to wall time; '' is the camera's own stream. |
offsetMs | numberDefault: 0 | Shift of the video against the data, −10000 to 10000 ms. |
fit | 'contain' | 'cover'Default: 'contain' | Letterbox the video or fill the panel. |