Charts
Distributions
How the values of a column spread: histograms, box plots, violins, CDF and Q-Q.
Each chart below is drawn live from the data of its example. All kinds: Chart types.
Histogram
A Histogram chart drawn by the engine from the data of the example below.
How the values of one column are distributed: their centre, spread and shape, with an optional normal curve and a tolerance line.
Data. One numeric column.
Example
// diameter: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Diameters',
columns: { diameter },
units: { diameter: 'mm' },
})
const chart = engine.charts.add('histogram', {
title: 'Shaft diameter',
settings: {
histColumn: 'diameter',
histBins: 30,
histNormal: true,
histColor: '#38bdf8',
histAlarm: { value: 25.03, style: 'dashed', width: 1.5, color: '#f87171' },
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
histColumn | stringDefault: '' | Column to bin. |
histBins | numberDefault: 0 | Number of bins; 0 picks it automatically. |
histNormal | booleanDefault: false | Overlay a normal curve with the same mean and deviation. |
histLogY | booleanDefault: false | Logarithmic count axis. |
histColor | stringDefault: #38bdf8 | Colour of the marks (hex). |
histAlarm | AlarmLine | nullDefault: null | Vertical line at a value (a tolerance limit). |
Box Plot
A Box Plot chart drawn by the engine from the data of the example below.
The distribution of a value per group as boxes (quartiles, median, whiskers, outliers): compare machines, shifts or batches at a glance.
Data. A value column and a group column (text or numbers). Without a group column, one box per dataset.
Example
// Presses.csv, 600 rows:
// press,cycle_time
// Press 1,50.7523
// Press 1,53.4573
// Press 1,51.1267
// …
await engine.datasets.addText(await file.text(), 'Presses.csv')
const chart = engine.charts.add('boxplot', {
title: 'Cycle time by press',
settings: {
boxValueCol: 'cycle_time',
boxGroupCol: 'press',
boxWhiskers: '1.5iqr',
boxColor: '#fb923c',
boxAlarm: { value: 60, style: 'dashed', width: 1.5, color: '#f87171' },
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
boxValueCol | stringDefault: '' | Value column. |
boxGroupCol | stringDefault: '' | One box per value of this column; '' gives one box per dataset. |
boxWhiskers | '1.5iqr' | 'minmax'Default: '1.5iqr' | Whiskers at 1.5 × IQR (outliers drawn beyond) or at the extremes. |
boxColor | stringDefault: #fb923c | Colour of the marks (hex). |
boxAlarm | AlarmLine | nullDefault: null | Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none. |
Violin
A Violin chart drawn by the engine from the data of the example below.
Like a box plot, with the full shape of each distribution (kernel density): shows two peaks or a long tail that a box hides.
Data. A value column and an optional group column (without one, a single violin).
Example
// Presses.csv, 600 rows:
// press,cycle_time
// Press 1,51.9929
// Press 1,56.8233
// Press 1,57.0943
// …
await engine.datasets.addText(await file.text(), 'Presses.csv')
const chart = engine.charts.add('violin', {
title: 'Cycle time by press',
settings: { vlValueCol: 'cycle_time', vlGroupCol: 'press', vlShowBox: true, vlColor: '#818cf8' },
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
vlValueCol | stringDefault: '' | Value column. |
vlGroupCol | stringDefault: '' | One violin per value of this column; '' draws one. |
vlShowBox | booleanDefault: true | Draw a box plot inside each violin. |
vlBandwidth | stringDefault: '' | Kernel bandwidth; '' uses Silverman's rule. |
vlOrientation | 'vertical' | 'horizontal'Default: 'vertical' | Direction of the value axis. |
vlColor | stringDefault: #818cf8 | Colour of the marks (hex). |
vlAlarm | AlarmLine | nullDefault: null | Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none. |
CDF / ECDF
A CDF / ECDF chart drawn by the engine from the data of the example below.
The empirical cumulative distribution: the share of values at or below each value. Reads percentiles directly (what share finishes under 200 ms) and compares columns without binning.
Data. One or more numeric columns.
Example
// before, after: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Latency',
columns: { before, after },
units: { before: 'ms', after: 'ms' },
})
const chart = engine.charts.add('cdfchart', {
title: 'Response time',
settings: {
cdValueCols: ['before', 'after'],
cdAlarm: { value: 200, style: 'dashed', width: 1.5, color: '#f87171' },
},
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
cdValueCols | string[]Default: [] | One curve per column. |
cdComplement | booleanDefault: false | Plot 1 − CDF (the share above each value). |
cdLogX | booleanDefault: false | Logarithmic value axis. |
cdAlarm | AlarmLine | nullDefault: null | Vertical line at a value. |
Q-Q Plot
A Q-Q Plot chart drawn by the engine from the data of the example below.
The quantiles of a column against a normal distribution (or against another column): points on the line mean the same shape. Checks normality before SPC or capability.
Data. One numeric column; in column mode, a second to compare with.
Example
// residual: arrays of numbers, all the same length
engine.datasets.addColumns({
name: 'Residuals',
columns: { residual },
})
const chart = engine.charts.add('qqplot', {
title: 'Normality check',
settings: { qqValueCol: 'residual', qqMode: 'normal', qqColor: '#a78bfa' },
})
engine.charts.mount(chart, document.getElementById('chart')!)Settings
| Name | Type | Description |
|---|---|---|
qqValueCol | stringDefault: '' | Column to check. |
qqMode | 'normal' | 'column'Default: 'normal' | Against a normal distribution or against qqRefCol. |
qqRefCol | stringDefault: '' | Reference column in 'column' mode. |
qqColor | stringDefault: #a78bfa | Colour of the marks (hex). |