Charts

Categories, hierarchies and flows

Totals per category, nested breakdowns, flows between stages and intervals in time.

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

Bar Chart

Values per category as bars, grouped or stacked: totals per line, shift or month.

Data. A category column (text or numbers; rows with the same category add up) and one or more value columns.

Example

TypeScript
await engine.datasets.addText(`line,material,setup,operator
Line 1,42,18,9
Line 2,31,25,14
Line 3,55,12,6
Line 4,24,30,11
Line 5,38,16,20`, 'Scrap.csv')

const chart = engine.charts.add('barchart', {
  title: 'Scrap by line',
  settings: {
    bcCategoryCol: 'line',
    bcValueCols: ['material', 'setup', 'operator'],
    bcMode: 'stacked',
    bcAlarm: { value: 70, style: 'dashed', width: 1.5, color: '#f87171' },
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
bcCategoryColstring
Default: ''
Category column; '' labels bars by row number.
bcValueColsstring[]
Default: []
One bar (or segment) per column.
bcMode'grouped' | 'stacked'
Default: 'grouped'
Side by side or on top of each other.
bcHorizontalboolean
Default: false
Horizontal bars.
bcValueScale{ scaleMin, scaleMax }
Default: '' / ''
Fixed value axis as strings; '' is automatic.
bcAlarmAlarmLine | null
Default: null
Reference line { value, style: "solid" | "dashed" | "dotted", width, color }; null for none.

Treemap

A hierarchy as nested rectangles sized by value: where the energy, cost or downtime goes, and which part of each area weighs most.

Data. Rows of name, parent and value. An empty parent (or one with no row of its own) makes a top-level area.

Example

TypeScript
await engine.datasets.addText(`name,parent,mwh
Press shop,,0
Paint shop,,0
Assembly,,0
Press A,Press shop,320
Press B,Press shop,260
Compressors,Press shop,140
Ovens,Paint shop,410
Booths,Paint shop,180
Line 1,Assembly,150
Line 2,Assembly,120
Lighting,Assembly,60`, 'Energy.csv')

const chart = engine.charts.add('treemap', {
  title: 'Energy by area',
  settings: { tmNameCol: 'name', tmParentCol: 'parent', tmValueCol: 'mwh' },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
tmNameColstring
Default: ''
Node name.
tmParentColstring
Default: ''
Name of the parent node.
tmValueColstring
Default: ''
Size of the leaves; parents add up their children.

Sankey

Flows between stages as bands whose width is the amount: material, energy or parts moving through a process, and where they are lost.

Data. Rows of source, target and value, one row per flow.

Example

TypeScript
await engine.datasets.addText(`from,to,tonnes
,,t
Coil,Blanking,100
Blanking,Stamping,88
Blanking,Scrap,12
Stamping,Welding,80
Stamping,Scrap,8
Welding,Paint,77
Welding,Scrap,3
Paint,Shipped,75
Paint,Scrap,2`, 'Flow.csv')

const chart = engine.charts.add('sankey', {
  title: 'Material flow',
  settings: { skSourceCol: 'from', skTargetCol: 'to', skValueCol: 'tonnes' },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
skSourceColstring
Default: ''
Node the flow leaves.
skTargetColstring
Default: ''
Node the flow reaches.
skValueColstring
Default: ''
Amount of the flow.

Flame Graph

A hierarchy as stacked bars whose width is the value: where the time of a cycle (or a program) goes, step by step.

Data. Rows of name, parent and value. An empty parent puts the row at the top.

Example

TypeScript
await engine.datasets.addText(`step,parent,seconds
Cycle,,0
Load,Cycle,0
Machine,Cycle,0
Unload,Cycle,6
Clamp,Load,4
Probe,Load,3
Rough,Machine,22
Finish,Machine,14
Tool change,Machine,0
Tool 1→2,Tool change,3
Tool 2→3,Tool change,4`, 'Cycle.csv')

const chart = engine.charts.add('flamegraph', {
  title: 'Cycle time breakdown',
  settings: { fgNameCol: 'step', fgParentCol: 'parent', fgValueCol: 'seconds', fgDirection: 'topdown' },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
fgNameColstring
Default: ''
Node name.
fgParentColstring
Default: ''
Parent node; '' puts every row under the root.
fgValueColstring
Default: ''
Own value of the node; parents add up their children.
fgDirection'topdown' | 'bottomup'
Default: 'topdown'
Root at the top or at the bottom.

Gantt Chart

Intervals on a time axis, one bar per row: test steps, machine states, maintenance windows, grouped by resource.

Data. Rows with a label, a start and an end (numbers on the same axis); optionally a group.

Example

TypeScript
await engine.datasets.addText(`task,start,end,rig
Warm-up,0,2,Rig A
Endurance,2,14,Rig A
Teardown,14,16,Rig A
Calibration,1,3,Rig B
Thermal cycles,3,10,Rig B
Vibration,10,15,Rig B
Report,15,18,Office`, 'Campaign.csv')

const chart = engine.charts.add('gantt', {
  title: 'Test campaign',
  settings: {
    gtLabelCol: 'task',
    gtStartCol: 'start',
    gtEndCol: 'end',
    gtGroupCol: 'rig',
    gtAlarm: { value: 16, style: 'dashed', width: 1.5, color: '#f87171' },
  },
})
engine.charts.mount(chart, document.getElementById('chart')!)

Settings

NameTypeDescription
gtLabelColstring
Default: ''
Bar label.
gtStartColstring
Default: ''
Start of each bar.
gtEndColstring
Default: ''
End of each bar.
gtGroupColstring
Default: ''
Group (colour and order) of each bar; '' for none.
gtAlarmAlarmLine | null
Default: null
Vertical line at a time (a deadline).