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
A X-Y scatter chart drawn by the engine from the data of the example below.
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
// 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
| Name | Type | Description |
|---|---|---|
xyXCol | stringDefault: '' | Column along X. |
xyYCol | stringDefault: '' | Column along Y. |
xyColorCol | string | nullDefault: null | Colour points by this column (colour map); null uses xyColor. |
xyColor | stringDefault: accent | Colour of the marks (hex). |
xyPointRadius | numberDefault: 1.8 | Point radius in px. |
xyDrawMode | 'points' | 'lines' | 'both'Default: 'points' | 'lines' joins the points in row order. |
xyLineWidth | numberDefault: 1 | Line width in px for lines and both. |
xyFit | XyFitSettings | nullDefault: null | Polynomial fit { degree: 1 | 2 | 3, color, lineStyle, width }. |
xyXScale | XyAxisScaleSettingsDefault: automatic | { scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null. |
xyYScale | XyAxisScaleSettingsDefault: automatic | { scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null. |
xyXAxisLine | AxisLineStyleDefault: solid | { style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }. |
xyYAxisLine | AxisLineStyleDefault: solid | { style: "none" | "solid" | "dashed" | "dotted", width (0.5 to 4 px), color (null = theme) }. |
xyGridLine | AxisLineStyleDefault: dotted | Grid lines. |
Bubble Chart
A Bubble Chart chart drawn by the engine from the data of the example below.
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
// 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
| Name | Type | Description |
|---|---|---|
bbXCol | stringDefault: '' | Column along X. |
bbYCol | stringDefault: '' | Column along Y. |
bbSizeCol | stringDefault: '' | Bubble area from this column. |
bbColorCol | stringDefault: '' | Colour from this column; '' uses bbColor. |
bbColorMode | 'numeric' | 'categorical'Default: 'categorical' | A colour map or one colour per value. |
bbMaxRadius | numberDefault: 24 | Radius of the largest bubble in px. |
bbColor | stringDefault: #64748b | Colour of the marks (hex). |
bbAlarm | AlarmLine | nullDefault: null | Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none. |
X-Y-Z mesh
A X-Y-Z mesh chart drawn by the engine from the data of the example below.
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
// 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
| Name | Type | Description |
|---|---|---|
xyzXCol | stringDefault: '' | Column along X. |
xyzYCol | stringDefault: '' | Column along Y. |
xyzZCol | stringDefault: '' | Column along Z (height). |
xyzViewMode | '3d' | 'xy' | 'xz' | 'yz'Default: '3d' | Free 3-D view or a projection on one plane. |
showMesh | booleanDefault: false | Draw a Delaunay surface through the points. |
meshStyle | 'filled' | 'wireframe' | 'both'Default: 'filled' | How the surface draws. |
meshOpacity | numberDefault: 0.85 | Surface opacity, 0 to 1. |
xyzPointRadius | numberDefault: 4 | Point radius in px. |
xyzXScale | XyAxisScaleSettingsDefault: automatic | { scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null. |
xyzYScale | XyAxisScaleSettingsDefault: automatic | { scaleMin, scaleMax, majorStep, minorStep } as strings ('' is automatic), plus alarm: AlarmLine | null. |
xyzZScale | XyAxisScaleSettingsDefault: 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. |
xyzColumns | string[]Default: [] | Columns of the matrix, in Y order. |
- view.autoscale() re-fits the camera after the data changes.
Heatmap
A Heatmap chart drawn by the engine from the data of the example below.
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
// 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
| Name | Type | Description |
|---|---|---|
hmMode | 'binned' | 'raw' | 'count' | 'correlation' | 'matrix'Default: 'binned' | What the cells hold (see Data). |
hmColumns | string[]Default: [] | Columns to correlate ('correlation') or the lines of the grid ('matrix'). |
hmXCol | stringDefault: '' | Column along X. |
hmYCol | stringDefault: '' | Column along Y. |
hmValueCol | stringDefault: '' | Value averaged per cell (count ignores it). |
hmXBins | numberDefault: 6 | Grid columns, 1 to 50. |
hmYBins | numberDefault: 6 | Grid rows, 1 to 50. |
hmXMin | stringDefault: '' | Start of the X range ('' is automatic). |
hmXMax | stringDefault: '' | End of the X range. |
hmYMin | stringDefault: '' | Start of the Y range. |
hmYMax | stringDefault: '' | End of the Y range. |
hmColorScheme | 'diverging' | 'plasma' | 'viridis'Default: 'diverging' | Colour scale. |
hmShowValues | booleanDefault: 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. |
hmContours | numberDefault: 0 | Isolines drawn over the map, 0 to 20. |
Polar
A Polar chart drawn by the engine from the data of the example below.
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
// 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
| Name | Type | Description |
|---|---|---|
polarAngleCol | stringDefault: '' | Angle column. |
polarRadiusCol | stringDefault: '' | Radius column. |
polarMode | 'waveform' | 'rose'Default: 'waveform' | 'waveform' joins the points; 'rose' bins them by angle. |
polarRadiusMin | stringDefault: '' | Inner radius ('' is automatic). |
polarRadiusMax | stringDefault: '' | Outer radius ('' is automatic). |
polarColor | stringDefault: #a78bfa | Colour of the marks (hex). |
Parallel Coords
A Parallel Coords chart drawn by the engine from the data of the example below.
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
// 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
| Name | Type | Description |
|---|---|---|
pcColumns | string[]Default: [] | The axes, left to right. |
pcColorByCol | stringDefault: '' | Colour each line by this column; '' uses pcColor. |
pcColor | stringDefault: #64748b | Colour of the marks (hex). |
Radar
A Radar chart drawn by the engine from the data of the example below.
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
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
| Name | Type | Description |
|---|---|---|
rdAxesCols | string[]Default: [] | One spoke per column. |
rdGroupCol | stringDefault: '' | One polygon per value of this column; '' draws one. |
rdFill | booleanDefault: true | Fill the polygons. |
rdColor | stringDefault: #38bdf8 | Colour of the first polygon. |