Charts

Relationships

How two, three or many columns relate: scatter, bubbles, 3-D, heatmaps, polar, parallel axes and radar.

Each chart below is drawn live from the data of its example. All kinds: Chart types.

X-Y scatter

One column against another, to see how they relate: points, a line through them in order, or both, with an optional polynomial fit and colour from a third column.

Data. Two numeric columns (and optionally a third for colour), one point per row.

Example

TypeScript
// rpm, torque, temp: arrays of numbers, all the same length
engine.datasets.addColumns({
  name: 'Dyno',
  columns: { rpm, torque, temp },
  units: { rpm: 'rpm', torque: 'N·m', temp: '°C' },
})

const chart = engine.charts.add('xyscatter', {
  title: 'Torque curve',
  settings: {
    xyXCol: 'rpm',
    xyYCol: 'torque',
    xyColorCol: 'temp',
    xyPointRadius: 2.2,
    xyFit: { degree: 2, color: '#f5a524', lineStyle: 'dashed', width: 2 },
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
xyXColstring
Default: ''
Column along X.
xyYColstring
Default: ''
Column along Y.
xyColorColstring | null
Default: null
Colour points by this column (colour map); null uses xyColor.
xyColorstring
Default: accent
Colour of the marks (hex).
xyPointRadiusnumber
Default: 1.8
Point radius in px.
xyDrawMode'points' | 'lines' | 'both'
Default: 'points'
'lines' joins the points in row order.
xyLineWidthnumber
Default: 1
Line width in px for lines and both.
xyFitXyFitSettings | null
Default: null
Polynomial fit { degree: 1 | 2 | 3, color, lineStyle, width }.
xyXScaleXyAxisScaleSettings
Default: automatic
{ scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null.
xyYScaleXyAxisScaleSettings
Default: automatic
{ scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null.
xyXAxisLineAxisLineStyle
Default: solid
{ style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }.
xyYAxisLineAxisLineStyle
Default: solid
{ style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }.
xyGridLineAxisLineStyle
Default: dotted
Grid lines.

Bubble Chart

A scatter where each point is a bubble sized (and optionally coloured) by more columns: four variables in one view.

Data. X, Y and size columns; optionally a colour column.

Example

TypeScript
// Lines.csv, 24 rows:
//   line,oee,scrap,output,site
//   L1,92.3273,3.9983,108.6672,North
//   L2,62.8644,3.404,223.3987,South
//   L3,62.7087,7.8432,268.815,East
//   …
await engine.datasets.addText(await file.text(), 'Lines.csv')

const chart = engine.charts.add('bubblechart', {
  title: 'Lines by output',
  settings: {
    bbXCol: 'oee',
    bbYCol: 'scrap',
    bbSizeCol: 'output',
    bbColorCol: 'site',
    bbColorMode: 'categorical',
    bbMaxRadius: 26,
    bbAlarm: { value: 6, style: 'dashed', width: 1.5, color: '#f87171' },
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
bbXColstring
Default: ''
Column along X.
bbYColstring
Default: ''
Column along Y.
bbSizeColstring
Default: ''
Bubble area from this column.
bbColorColstring
Default: ''
Colour from this column; '' uses bbColor.
bbColorMode'numeric' | 'categorical'
Default: 'categorical'
A colour map or one colour per value.
bbMaxRadiusnumber
Default: 24
Radius of the largest bubble in px.
bbColorstring
Default: #64748b
Colour of the marks (hex).
bbAlarmAlarmLine | null
Default: null
Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none.

X-Y-Z mesh

Three columns in 3-D: points, a surface through them, or a matrix drawn as a surface. Drag to rotate, wheel to zoom.

Data. X, Y and Z columns (points mode), or one row per X with a column per Y step ('matrix' mode).

Example

TypeScript
// x, y, z: arrays of numbers, all the same length
engine.datasets.addColumns({
  name: 'Surface',
  columns: { x, y, z },
})

const chart = engine.charts.add('xyzmesh', {
  title: 'Response surface',
  settings: {
    xyzXCol: 'x',
    xyzYCol: 'y',
    xyzZCol: 'z',
    showMesh: true,
    meshStyle: 'both',
    meshOpacity: 0.85,
    xyzPointRadius: 2,
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
xyzXColstring
Default: ''
Column along X.
xyzYColstring
Default: ''
Column along Y.
xyzZColstring
Default: ''
Column along Z (height).
xyzViewMode'3d' | 'xy' | 'xz' | 'yz'
Default: '3d'
Free 3-D view or a projection on one plane.
showMeshboolean
Default: false
Draw a Delaunay surface through the points.
meshStyle'filled' | 'wireframe' | 'both'
Default: 'filled'
How the surface draws.
meshOpacitynumber
Default: 0.85
Surface opacity, 0 to 1.
xyzPointRadiusnumber
Default: 4
Point radius in px.
xyzXScaleXyAxisScaleSettings
Default: automatic
{ scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null.
xyzYScaleXyAxisScaleSettings
Default: automatic
{ scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null.
xyzZScaleXyAxisScaleSettings
Default: automatic
{ scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null.
xyzMode'points' | 'matrix'
Default: 'points'
'matrix' draws a uniform grid: rows along X, the xyzColumns along Y, each value a height.
xyzColumnsstring[]
Default: []
Columns of the matrix, in Y order.
  • view.autoscale() re-fits the camera after the data changes.

Heatmap

A value as colour over a grid: the mean of a column binned by two others (engine maps, operating regions), counts, a correlation matrix or a breakpoint table.

Data. 'binned' / 'raw' / 'count': X, Y (and value) columns. 'correlation': the columns to correlate. 'matrix': one column per grid line.

Example

TypeScript
// speed, load, eff: arrays of numbers, all the same length
engine.datasets.addColumns({
  name: 'Motor map',
  columns: { speed, load, eff },
  units: { speed: 'rpm', load: '%', eff: '%' },
})

const chart = engine.charts.add('heatmap', {
  title: 'Efficiency map',
  settings: {
    hmMode: 'binned',
    hmXCol: 'speed',
    hmYCol: 'load',
    hmValueCol: 'eff',
    hmXBins: 10,
    hmYBins: 5,
    hmXMin: '0',
    hmXMax: '6000',
    hmYMin: '0',
    hmYMax: '100',
    hmColorScheme: 'viridis',
    hmShowValues: true,
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
hmMode'binned' | 'raw' | 'count' | 'correlation' | 'matrix'
Default: 'binned'
What the cells hold (see Data).
hmColumnsstring[]
Default: []
Columns to correlate ('correlation') or the lines of the grid ('matrix').
hmXColstring
Default: ''
Column along X.
hmYColstring
Default: ''
Column along Y.
hmValueColstring
Default: ''
Value averaged per cell (count ignores it).
hmXBinsnumber
Default: 6
Grid columns, 1 to 50.
hmYBinsnumber
Default: 6
Grid rows, 1 to 50.
hmXMinstring
Default: ''
Start of the X range ('' is automatic).
hmXMaxstring
Default: ''
End of the X range.
hmYMinstring
Default: ''
Start of the Y range.
hmYMaxstring
Default: ''
End of the Y range.
hmColorScheme'diverging' | 'plasma' | 'viridis'
Default: 'diverging'
Colour scale.
hmShowValuesboolean
Default: true
Print the value in each cell.
hmRange{ scaleMin, scaleMax }
Default: '' / ''
Fixed value axis as strings; '' is automatic.
hmSpacing'uniform' | 'values'
Default: 'uniform'
'values' sizes cells by position ('matrix' and 'raw'), for breakpoint tables.
hmContoursnumber
Default: 0
Isolines drawn over the map, 0 to 20.

Polar

A value against an angle: crank-angle traces, directional data, rotating machinery. As a line or a rose (binned by angle).

Data. An angle column (radians, or degrees when any value is beyond a full turn) and a radius column.

Example

TypeScript
// angle, amplitude: arrays of numbers, all the same length
engine.datasets.addColumns({
  name: 'Shaft',
  columns: { angle, amplitude },
  units: { angle: '°', amplitude: 'µm' },
})

const chart = engine.charts.add('polar', {
  title: 'Shaft orbit',
  settings: {
    polarAngleCol: 'angle',
    polarRadiusCol: 'amplitude',
    polarMode: 'waveform',
    polarRadiusMin: '0',
    polarColor: '#a78bfa',
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
polarAngleColstring
Default: ''
Angle column.
polarRadiusColstring
Default: ''
Radius column.
polarMode'waveform' | 'rose'
Default: 'waveform'
'waveform' joins the points; 'rose' bins them by angle.
polarRadiusMinstring
Default: ''
Inner radius ('' is automatic).
polarRadiusMaxstring
Default: ''
Outer radius ('' is automatic).
polarColorstring
Default: #a78bfa
Colour of the marks (hex).

Parallel Coords

Many columns at once: one vertical axis each, one line per row. Patterns that only show across several variables (which settings lead to good batches).

Data. Several numeric columns; optionally one to colour the lines by.

Example

TypeScript
// temp, pressure, time, speed, yield: arrays of numbers, all the same length
engine.datasets.addColumns({
  name: 'Batches',
  columns: { temp, pressure, time, speed, yield },
})

const chart = engine.charts.add('parallelcoords', {
  title: 'Batch parameters',
  settings: { pcColumns: ['temp', 'pressure', 'time', 'speed', 'yield'], pcColorByCol: 'yield' },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
pcColumnsstring[]
Default: []
The axes, left to right.
pcColorByColstring
Default: ''
Colour each line by this column; '' uses pcColor.
pcColorstring
Default: #64748b
Colour of the marks (hex).

Radar

A profile across several measures, one polygon per group: suppliers, test specimens, products compared on the same axes.

Data. One column per spoke; a group column for one polygon per value (rows of a group are averaged).

Example

TypeScript
await engine.datasets.addText(`supplier,quality,price,delivery,support,capacity
Supplier A,8.5,6,7.5,9,6.5
Supplier B,6.5,9,6,5.5,8.5
Supplier C,7.5,7,9,7,7`, 'Suppliers.csv')

const chart = engine.charts.add('radar', {
  title: 'Supplier scores',
  settings: {
    rdAxesCols: ['quality', 'price', 'delivery', 'support', 'capacity'],
    rdGroupCol: 'supplier',
    rdFill: true,
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
rdAxesColsstring[]
Default: []
One spoke per column.
rdGroupColstring
Default: ''
One polygon per value of this column; '' draws one.
rdFillboolean
Default: true
Fill the polygons.
rdColorstring
Default: #38bdf8
Colour of the first polygon.