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

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

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

NameTypeDescription
histColumnstring
Default: ''
Column to bin.
histBinsnumber
Default: 0
Number of bins; 0 picks it automatically.
histNormalboolean
Default: false
Overlay a normal curve with the same mean and deviation.
histLogYboolean
Default: false
Logarithmic count axis.
histColorstring
Default: #38bdf8
Colour of the marks (hex).
histAlarmAlarmLine | null
Default: null
Vertical line at a value (a tolerance limit).

Box Plot

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

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

NameTypeDescription
boxValueColstring
Default: ''
Value column.
boxGroupColstring
Default: ''
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.
boxColorstring
Default: #fb923c
Colour of the marks (hex).
boxAlarmAlarmLine | null
Default: null
Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none.

Violin

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

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

NameTypeDescription
vlValueColstring
Default: ''
Value column.
vlGroupColstring
Default: ''
One violin per value of this column; '' draws one.
vlShowBoxboolean
Default: true
Draw a box plot inside each violin.
vlBandwidthstring
Default: ''
Kernel bandwidth; '' uses Silverman's rule.
vlOrientation'vertical' | 'horizontal'
Default: 'vertical'
Direction of the value axis.
vlColorstring
Default: #818cf8
Colour of the marks (hex).
vlAlarmAlarmLine | null
Default: null
Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none.

CDF / ECDF

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

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

NameTypeDescription
cdValueColsstring[]
Default: []
One curve per column.
cdComplementboolean
Default: false
Plot 1 − CDF (the share above each value).
cdLogXboolean
Default: false
Logarithmic value axis.
cdAlarmAlarmLine | null
Default: null
Vertical line at a value.

Q-Q Plot

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

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

NameTypeDescription
qqValueColstring
Default: ''
Column to check.
qqMode'normal' | 'column'
Default: 'normal'
Against a normal distribution or against qqRefCol.
qqRefColstring
Default: ''
Reference column in 'column' mode.
qqColorstring
Default: #a78bfa
Colour of the marks (hex).