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

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

TypeScript
// 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

NameTypeDescription
seriesPlotSeries[]
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.
lineWidthnumber
Default: 1
Trace width in px.
xAxisLineAxisLineStyle
Default: solid
{ style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }.
yAxisLineAxisLineStyle
Default: solid
{ style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }.
gridLineAxisLineStyle
Default: dotted
Grid lines, same shape as the axis lines.
beaconBeaconSettings
Default: off
{ enabled, reference: "dataset" | "previous" | "none", datasetId, datasetColor, previousColor }: one live cycle at a time (X starting over) against reference data.
addColumnstring
Default: first numeric column
The column the settings dialog offers to add next.
envelopeboolean
Default: 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

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

TypeScript
// 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

NameTypeDescription
acXColstring
Default: ''
Column along X.
acYColsstring[]
Default: []
Columns drawn as areas, bottom first when stacked.
acStackedboolean
Default: false
Stack the areas instead of overlaying them.
acYScale{ scaleMin, scaleMax }
Default: '' / ''
Fixed value axis as strings; '' is automatic.
acAlarmAlarmLine | null
Default: null
Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none.

Spectrum

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

TypeScript
// 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

NameTypeDescription
specSignalColstring
Default: ''
Signal to transform.
specTimeColstring
Default: ''
Time column: the rate is its sample count over its span. '' uses specSampleRate.
specSampleRatestring
Default: '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.
specLogXboolean
Default: false
Logarithmic frequency axis.
specColorstring
Default: #34d399
Colour of the marks (hex).
specAlarmAlarmLine | null
Default: null
Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none.

Spectrogram

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

TypeScript
// 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

NameTypeDescription
sgSignalColstring
Default: ''
Signal to transform.
sgTimeColstring
Default: ''
Time column for the rate; '' uses sgSampleRate.
sgSampleRatestring
Default: '1000'
Sample rate in Hz, used when sgTimeCol is empty.
sgWindowSizenumber
Default: 512
FFT window in samples, a power of two. Larger: finer frequency, coarser time.
sgOverlapnumber
Default: 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.
sgLogFreqboolean
Default: 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

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

TypeScript
// 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

NameTypeDescription
ccValueColstring
Default: ''
Measured value.
ccSubgroupColstring
Default: ''
Subgroup column for X̄-R; '' plots individuals (I-MR).
ccSigmaLevelnumber
Default: 3
Control limits at this many sigma.
ccColorstring
Default: #22d3ee
Colour of the marks (hex).

Gauges

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

TypeScript
// 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

NameTypeDescription
ggGaugesGaugeItem[]
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

TypeScript
// 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

NameTypeDescription
cameraStreamIdstring
Default: ''
The camera's live connection id.
camerasstring[]
Default: []
Up to 9 camera ids in order (cameras[0] = cameraStreamId); two or more draw a wall.
syncStreamIdstring
Default: ''
Stream whose clock maps the cursor to wall time; '' is the camera's own stream.
offsetMsnumber
Default: 0
Shift of the video against the data, −10000 to 10000 ms.
fit'contain' | 'cover'
Default: 'contain'
Letterbox the video or fill the panel.