Capnography and Pulse Oximetry Waveforms
What are capnography and pulse oximetry waveforms?
Capnography measures carbon dioxide (CO₂) in the breath continuously and draws it as a waveform, the capnogram, whose value at the end of each breath is the end-tidal CO₂ (EtCO₂). Pulse oximetry shines red and infrared light through a finger to estimate blood oxygen saturation (SpO₂), and draws each heartbeat as the pleth waveform.

A simulated capnogram and pleth trace on a sweeping monitor display (sample data). Try the interactive version.
This page explains how these traces are made, drawn and read. It is not clinical guidance: diagnosis and treatment decisions belong to trained clinicians, using their local protocols.
- A normal capnogram has four phases: a zero baseline, a steep rise, a near-flat plateau and a steep fall. EtCO₂ is the value at the end of the plateau, normally 35 to 45 mmHg in adults.
- The shape tells you as much as the number. A shark fin points to narrowed airways, a raised baseline to rebreathing, a flat line to no breath reaching the sensor.
- The pleth shows the pulse that the SpO₂ reading is based on. If the pleth is messy, the SpO₂ and pulse rate are unreliable.
- Capnography tracks ventilation breath by breath; pulse oximetry tracks oxygenation and can lag by minutes.
- Monitors sweep the CO₂ trace slowly so several breaths fit on screen, and auto-scale the pleth, so check the perfusion index before trusting a tall-looking pulse.
What is capnography?
Capnography is the continuous measurement of CO₂ in the gas a patient breathes in and out. Most capnometers measure how strongly the gas absorbs infrared light at a wavelength CO₂ absorbs well (around 4.3 µm), and report the result as a partial pressure in mmHg or kPa (1 kPa is about 7.5 mmHg), or as a percentage.
Three related words are easy to mix up:
| Term | What it is |
|---|---|
| Capnometry | The number alone: EtCO₂ and often the respiratory rate, without a waveform |
| Capnography | Continuous measurement and display of CO₂ as a waveform |
| Capnogram | The waveform itself. A time capnogram plots CO₂ against time (the usual monitor trace); a volumetric capnogram plots it against the volume breathed out |
It is used in operating theatres, intensive care, emergency departments, ambulances and sedation suites. A capnogram can confirm that a breathing tube is in the windpipe rather than the oesophagus, warn of a disconnected circuit or a stopped breath within seconds, and help judge the quality of chest compressions during resuscitation. The American Society of Anesthesiologists' monitoring standards require end-tidal CO₂ monitoring whenever a breathing tube or supraglottic airway is in place, and ask for every effort to monitor exhaled CO₂ during general anaesthesia and during moderate or deep sedation.
Mainstream vs sidestream capnography
The sensor can sit on the airway or at the end of a sampling tube.
| Mainstream | Sidestream | |
|---|---|---|
| Where the CO₂ is measured | In a small adapter fitted directly in the breathing circuit | In the monitor, from gas pumped continuously along a thin sampling line |
| Response | Immediate, with a sharp waveform | Delayed by the time gas takes to travel along the tube, and slightly smoothed |
| Patients | Mostly intubated, ventilated patients | Intubated patients, and patients breathing on their own through a nasal or oral cannula |
| Drawbacks | Adds weight and a little dead space at the airway | Water and secretions can block the line; a leak or very small breaths dilute the sample and read low |
The international standard for respiratory gas monitors, ISO 80601-2-55, requires the maker to state the delay and the rise time of the measurement, because both change how the waveform looks.
The four phases of a normal capnogram
A normal capnogram has four phases: a flat baseline, a steep rise, a slowly rising plateau that ends at the EtCO₂ point, and a steep fall as the next breath starts.
A normal breath draws the same squared-off shape every time. Reading it from left to right:
- Phase I: the baseline. Gas with no CO₂ in it passes the sensor: the fresh gas breathed in, then the first gas breathed out, which comes from the airways (the anatomical dead space) and never took part in gas exchange. It should read zero.
- Phase II: the expiratory upstroke. Gas from the alveoli, the small air sacs where CO₂ leaves the blood, starts to reach the sensor and mixes with the dead-space gas. The trace rises steeply.
- Phase III: the alveolar plateau. Almost pure alveolar gas is breathed out. The plateau climbs gently, because the slowest-emptying parts of the lung hold the most CO₂ and empty last. Its last point is the end-tidal CO₂ (EtCO₂).
- Phase 0: the inspiratory downstroke. The next breath in sweeps fresh gas past the sensor, and the trace falls steeply back to the baseline. Many emergency and nursing texts call this phase IV; in the anaesthesia literature, phase IV is a small final upswing seen at the end of phase III in some patients, such as in pregnancy.
Two angles describe the corners. The alpha angle, between phases II and III, is normally about 100 to 110 degrees; it widens when the plateau slopes, as in airway obstruction. The beta angle, between the end of phase III and the downstroke, is close to 90 degrees; it widens with rebreathing.
Normal capnography values
| Measure | Typical normal value (adults) | What moves it |
|---|---|---|
| End-tidal CO₂ (EtCO ₂) | 35–45 mmHg (about 4.7–6.0 kPa) | Breathing rate and depth, CO₂ production, blood flow through the lungs |
| Inspired CO₂ (the baseline) | 0 mmHg | Rises above zero with rebreathing |
| Respiratory rate | 12–20 breaths per minute | Counted from the capnogram, one waveform per breath |
| Arterial minus end-tidal CO₂ | A few mmHg | Widens when parts of the lung are ventilated but poorly perfused, as in a pulmonary embolism or low cardiac output |
The respiratory rate range is the band that scores zero in the UK's National Early Warning Score (NEWS2). Children and infants breathe faster, and their normal ranges are different.
How to read a capnogram step by step
- Is there a waveform? No waveform means no CO₂ is reaching the sensor: no breathing, a disconnected or blocked circuit, a misplaced tube or a blocked sampling line.
- Does the baseline return to zero? A baseline above zero means CO₂ is being breathed back in.
- How high is the end-tidal value, and is it steady, rising or falling from breath to breath?
- How fast and how regular? Count the waveforms per minute, and look for pauses.
- What shape is it? Check the rise, the plateau and the fall against the normal shape above.
Watch the trend as well as the single breath. A slow EtCO₂ drift over 10 minutes says something different from a sudden drop.
Abnormal capnography waveforms
Each common breathing or equipment problem changes the capnogram in its own way, so the shape often points to the cause before the number does.
| Pattern | What the trace looks like | Common causes |
|---|---|---|
| Shark fin | Slow, curved rise and a plateau that keeps sloping upwards, so each breath looks like a fin | Bronchospasm, asthma, COPD; a kinked or partly blocked tube |
| Rebreathing | Baseline (and the downstroke) no longer returns to zero; EtCO₂ creeps up | An exhausted CO₂ absorber, a faulty valve in the breathing circuit, too little fresh gas flow |
| Hypoventilation | Fewer breaths, with higher EtCO₂ (above 45 mmHg); the waveforms can also get smaller with shallow breathing, and with very shallow breaths EtCO₂ can read falsely low | Opioids and sedatives, exhaustion, neuromuscular weakness |
| Hyperventilation | More breaths, with lower EtCO₂ (below 35 mmHg) | Anxiety, pain, over-ventilation by a ventilator or bag |
| Curare cleft | A notch cut into the plateau | The patient's own breathing effort during mechanical ventilation, often as a muscle relaxant wears off |
| Cardiogenic oscillations | Small ripples at the end of the downstroke, in time with the heartbeat | The heart beating against the lungs during a slow breath out; harmless |
| Sudden loss of waveform | The trace drops to a flat line | Apnoea, disconnection, a dislodged or oesophageal tube, a blocked sampling line |
| Sudden fall in EtCO₂ with waveforms still present | Lower plateaus, same shape | A large drop in blood flow through the lungs: cardiac arrest, massive pulmonary embolism, severe bleeding; or a leak in the sampling line |
During cardiopulmonary resuscitation, EtCO₂ reflects how much blood the chest compressions push through the lungs. Resuscitation guidelines from the American Heart Association recommend waveform capnography to confirm and monitor tube placement, and an abrupt, sustained rise in EtCO₂ can be the first sign that the heart has started beating again.
What is pulse oximetry?
Pulse oximetry estimates the percentage of haemoglobin in arterial blood that is carrying oxygen. A clip on a finger, toe or earlobe has two light-emitting diodes on one side, one red (around 660 nm) and one infrared (around 940 nm), and a light detector on the other side or next to them. The reading is called SpO₂; the same quantity measured in a blood sample is SaO₂. The US National Institute of Standards and Technology (NIST) puts normal saturation for the average person at 95% to 100%; people with long-term lung disease can have a lower usual level.
How SpO₂ is worked out: the ratio of ratios
Oxygenated haemoglobin absorbs less red light and more infrared light than deoxygenated haemoglobin. Most of the light the detector sees is absorbed by things that don't change from beat to beat: skin, bone, venous blood and the steady part of the arterial blood. That steady part is called DC. With each heartbeat, extra arterial blood swells the tissue and absorbs a little more light; that pulsing part is called AC. Dividing AC by DC at each wavelength cancels out the thickness of the finger and the brightness of the LEDs, and dividing one of those by the other gives the ratio of ratios :
A low means well-oxygenated blood. Each manufacturer turns into SpO₂ with a calibration curve measured on healthy volunteers breathing low-oxygen gas mixtures. A commonly quoted straight-line approximation is , so reads about 97% and reads about 85%. Because the calibration comes from volunteers whose saturation was taken down only to about 70%, readings below that are less certain. The pulse oximeter standard, ISO 80601-2-61, sets out how makers run these controlled desaturation studies.
The pleth waveform (photoplethysmogram)
The pleth waveform shows each heartbeat as a pulse of blood volume in the finger, and its shape tells you whether the SpO₂ reading can be trusted.
The pleth trace is the pulsing (AC) part of the infrared signal, plotted against time. Light reaching the detector falls as blood volume rises, so monitors turn the signal upside down to make each pulse point upwards. A normal pleth pulse has:
- a steep upstroke as the pressure wave from the heart arrives;
- a rounded systolic peak;
- a dicrotic notch, a small dip on the way down, linked to the closing of the aortic valve and to pressure waves reflected back from the lower body;
- a smaller diastolic wave after the notch, then a slow fall to the start of the next pulse.
The notch is clearest in young people with elastic arteries. It fades with age and stiffer arteries, and with cold or vasoconstricted fingers. Breathing also makes the pulse heights and the baseline rise and fall slightly from breath to breath.
Plethysmograph, photoplethysmography and PPG
These words describe the same kind of measurement at different levels:
- A plethysmograph is any instrument that measures changes in the volume of part of the body. A body plethysmograph, the sealed "body box" used in lung function tests, is one; the pulse oximeter's light sensor is another.
- Photoplethysmography (PPG) is the optical method: measuring volume changes in tissue through changes in absorbed light. Smartwatches and fitness bands use green-light PPG for heart rate.
- A photoplethysmogram, PPG signal or pleth waveform is the trace it produces. On a patient monitor the channel is labelled "Pleth".
Perfusion index
The perfusion index (PI) is the pulse amplitude as a percentage of the steady signal:
It measures how strong the pulse is at the sensor, which depends on blood flow to the skin. Warm, well-perfused fingers give a PI of a few per cent; cold, constricted fingers give a fraction of 1%. In one study of critically ill adults, a PI below 1.4 identified patients with poor peripheral perfusion. A low PI also means the signal is small compared with noise, so the SpO₂ and pulse rate become less reliable.
Pleth problems: low perfusion, motion artefact and other errors
A poor pleth signal is the commonest reason for a wrong SpO₂ or pulse rate, and each cause leaves a different mark on the trace.
| Problem | What the pleth looks like | Effect on the numbers |
|---|---|---|
| Low perfusion (cold hands, shock, vasoconstricting drugs) | Small, rounded pulses with no notch. Auto-scaling can make them look normal size, but the PI is low | SpO₂ and pulse rate wander or drop out |
| Motion artefact (shivering, tapping, transport) | Large, irregular waves that hide the pulses | Missed or extra beats give a wrong pulse rate. Movement changes the red and infrared signals by about the same fraction, so is pulled towards 1 and SpO₂ falsely towards about 85% |
| Poor probe fit or bright room light | Noisy or flat trace | Readings unstable or missing |
| Carbon monoxide poisoning | Normal-looking pleth | Carboxyhaemoglobin is read as if it were oxyhaemoglobin, so SpO₂ reads falsely high |
| Darker skin pigmentation | Normal-looking pleth | Readings can be higher than the true saturation. A 2020 study found hidden low oxygen levels about three times as often in Black patients as in white patients |
| Nail varnish, dyes such as methylene blue | Often normal-looking | Readings can be falsely low or high |
A good pleth is the quickest check on whether to believe an SpO₂ number: regular pulses with a clear upstroke, at the same rate as the ECG.
How monitors draw capnogram and pleth traces
Bedside monitors show these waveforms in sweep mode: each trace stays still and a write point moves from left to right, overwriting the previous sweep a little ahead of it (see sweeping vs scrolling in the strip chart guide). The time on screen is set by the sweep speed in millimetres per second.
| Trace | Typical default sweep speeds | Why |
|---|---|---|
| ECG | 25 mm/s (sometimes 50 mm/s) | Matches ECG paper, so intervals can be read the same way |
| Pleth | 25 mm/s | Keeps the pulses in step with the ECG above it |
| CO₂ and respiration | 6.25 mm/s, with 3.13 or 12.5 mm/s as options | Breaths are slow; at 6.25 mm/s several breaths fit across the screen |
The time window is the trace width divided by the sweep speed. On a 150 mm wide trace, 25 mm/s shows 6 seconds and 6.25 mm/s shows 24 seconds. A capnogram swept too fast looks stretched and shows one breath at a time; a pleth swept too slowly squashes the pulses so the notch can't be seen.
The two traces are also scaled differently. The CO₂ trace has a fixed scale in mmHg (often 0–50 or 0–75), so its height can be read as a value. The pleth is usually auto-scaled (auto-gain): the monitor stretches it to fill its space, because its absolute size depends on the finger, not on oxygen. That is why a low-perfusion pleth can look as tall as a healthy one, and why monitors show the PI or a signal-quality bar beside it.
The numbers are worked out from the waveforms. EtCO₂ is the peak of each breath and the respiratory rate comes from the time between breaths, often averaged over several. SpO₂ is averaged over several seconds to smooth out noise, so it lags behind sudden changes, and a finger probe reacts more slowly than an earlobe probe. Sidestream capnographs add the gas transit delay on top.
Capnogram and pleth alongside the ECG
On a patient monitor the pleth sits under the ECG, and the capnogram under that. Each pleth pulse arrives at the finger a fraction of a second after the ECG's R wave, the time the pressure wave takes to travel from the heart. Comparing the two is a quick check on both: a pulse rate that matches the heart rate means the oximeter is seeing real pulses, and a heart rate higher than the pulse rate (a pulse deficit) can mean some beats, for example in atrial fibrillation, are too weak to reach the finger. SciChart's JavaScript vital signs monitor shows ECG, blood pressure, pleth and respiration together.
Capnography vs pulse oximetry vs ECG
Capnography shows breathing, pulse oximetry shows oxygenation and the pulse, and the ECG shows the heart's electrical activity, so a monitor usually draws all three.
| Capnography | Pulse oximetry | ECG | |
|---|---|---|---|
| Measures | CO₂ in exhaled gas | Oxygen saturation of arterial blood, and the pulse | Electrical activity of the heart |
| Tells you about | Ventilation: is air moving in and out, and how much | Oxygenation: is blood carrying enough oxygen | Heart rate and rhythm |
| Responds to a stopped breath | Within one breath: the waveform goes flat | Late: SpO₂ falls only once oxygen stores run down, which can take minutes with supplemental oxygen | Late, and only indirectly |
| Main waveform | Capnogram | Pleth (PPG) | ECG trace |
| Typical sweep speed | 6.25 mm/s | 25 mm/s | 25 mm/s |
| Common failure | Blocked or leaking sampling line | Motion, low perfusion | Electrode noise, movement |
The two respiratory monitors answer different questions, and each covers the other's blind spot. In a study of anaesthetised patients whose breathing was deliberately cut by half, SpO₂ fell in those breathing room air but did not fall at all over 10 minutes in those breathing 25 or 30% oxygen.
Common capnography and pleth mistakes
Most errors in reading these traces come from trusting a number without checking the waveform behind it.
- Trusting the number without the waveform. An EtCO₂ value with no proper capnogram behind it, or an SpO₂ with a messy pleth, may be measuring noise. Check the shape first.
- Reading a normal SpO₂ as "breathing is fine". With supplemental oxygen, saturation can stay normal while CO₂ builds up from slow, shallow breathing. The capnogram shows hypoventilation long before the oximeter does.
- Taking EtCO₂ as the arterial CO₂. EtCO₂ is usually a few mmHg lower, and the gap widens with lung disease or low cardiac output. Check it against a blood gas when it matters.
- Ignoring a raised baseline. A capnogram whose baseline doesn't return to zero is a warning about the breathing circuit, even if EtCO₂ looks normal.
- Judging perfusion by the height of the pleth. The pleth is auto-scaled; read the perfusion index or the signal-quality indicator instead.
- Comparing traces drawn at different sweep speeds. A shape changes with the sweep speed. Note the speed before comparing a trace with a reference picture or an earlier recording.
- Forgetting the delays. A sidestream reading trails the breath by the transit time, and SpO₂ is averaged over several seconds. Neither shows the patient's state at that exact moment.
How to build a capnography and pleth monitor display in JavaScript, React or Angular
Patient monitors redraw several waveforms at 100 or more samples a second each, around the clock. This demo feeds 100 samples a second into two traces that use SciChart.js's built-in sweeping mode, where new samples overwrite the oldest from left to right as on a bedside monitor. It simulates a patient and runs the samples through the same kind of logic a monitor uses: it finds each breath in the CO₂ signal for EtCO₂, inspired CO₂ and respiratory rate, and works out SpO₂ from the ratio of ratios, the perfusion index and the pulse rate from raw red and infrared light.
Change Breathing to see a shark fin, rebreathing, hypoventilation or apnoea (the apnoea alarm fires after 10 seconds, a short setting for the demo). Change Pleth to low perfusion or motion artefact, and watch what happens to SpO₂, the pulse rate and the PI. CO₂ sweep and Pleth sweep set each trace's sweep speed. Pause stops the sweep: then scroll to zoom in time, drag to pan, double-click to reset, and hover for values.
Here is the code for this chart. The monitor algorithms are plain JavaScript; SciChart.js draws the two sweeping traces.
- JavaScript
- React
- Angular
// A two-trace patient monitor in sweep mode: a capnogram and a pleth trace, with the numbers a monitor
// works out from them, drawn with SciChart.js
const {
SciChartSurface,
NumericAxis,
FastLineRenderableSeries,
XyDataSeries,
EllipsePointMarker,
NumberRange,
EAutoRange,
EXyDirection,
SciChartJsNavyTheme,
CursorModifier,
MouseWheelZoomModifier,
ZoomPanModifier,
ZoomExtentsModifier
} = SciChart;
// or, for npm, import { SciChartSurface, ... } from "scichart"
const TRACE_WIDTH_MM = 150; // a sweep speed in mm/s becomes a time window, for a trace this wide
// --- Monitor algorithms (plain JavaScript): numbers from the waveforms ---
// Capnometer: finds each exhalation in the CO2 waveform, then reports end-tidal CO2 (the peak at the end
// of the breath), inspired CO2 (the lowest level between breaths) and the respiratory rate
function createCapnometer(apnoeaDelaySeconds) {
let exhaling = false;
let peak = 0;
let lowest = Infinity;
const starts = [];
const state = { etco2: NaN, inspired: NaN, rate: NaN, apnoea: false, add: null };
state.add = (time, co2) => {
if (!exhaling && co2 > 14) {
// Start of an exhalation: the CO2 rises through 14 mmHg
exhaling = true;
peak = co2;
if (Number.isFinite(lowest)) state.inspired = Math.max(0, lowest);
lowest = Infinity;
starts.push(time);
if (starts.length > 5) starts.shift();
if (starts.length > 1) state.rate = (60 * (starts.length - 1)) / (starts[starts.length - 1] - starts[0]);
} else if (exhaling) {
peak = Math.max(peak, co2);
if (co2 < 10) {
exhaling = false;
state.etco2 = peak;
}
} else {
lowest = Math.min(lowest, co2);
}
state.apnoea = starts.length > 0 && time - starts[starts.length - 1] > apnoeaDelaySeconds;
};
return state;
}
// Pulse oximeter: turns the raw red and infrared light into the pleth trace, and works out SpO2 from the
// ratio of ratios, the perfusion index and the pulse rate
function createOximeter(sampleRate) {
const windowSize = Math.round(3 * sampleRate); // 3 s of samples for each reading
const smoothing = 0.35; // light smoothing of the raw light signals
const dcSmoothing = 1 / (2 * sampleRate); // the steady (DC) level, averaged over about 2 s
let ir = NaN;
let red = NaN;
let dcIr = NaN;
let dcRed = NaN;
const irPulse = []; // pulsing part as % of the steady level, newest last
const redPulse = [];
let count = 0;
let lastBeat = -1;
let wasAbove = false;
const beatIntervals = [];
const state = { spo2: NaN, perfusionIndex: NaN, pulseRate: NaN, add: null };
const range = (values) => Math.max(...values) - Math.min(...values);
// Returns the pleth value to draw: the infrared pulse, upside down from the raw light so that more
// blood in the finger plots upwards
state.add = (time, rawIr, rawRed) => {
ir = Number.isNaN(ir) ? rawIr : ir + smoothing * (rawIr - ir);
red = Number.isNaN(red) ? rawRed : red + smoothing * (rawRed - red);
dcIr = Number.isNaN(dcIr) ? ir : dcIr + dcSmoothing * (ir - dcIr);
dcRed = Number.isNaN(dcRed) ? red : dcRed + dcSmoothing * (red - dcRed);
const pleth = (100 * (dcIr - ir)) / dcIr;
irPulse.push(pleth);
redPulse.push((100 * (dcRed - red)) / dcRed);
if (irPulse.length > windowSize) {
irPulse.shift();
redPulse.shift();
}
// Pulse detection: an upward crossing of the middle of the last 3 s, at least 0.3 s after the last beat
const middle = Math.min(...irPulse) + 0.5 * range(irPulse);
const above = pleth > middle;
if (above && !wasAbove && time - lastBeat > 0.3) {
if (lastBeat >= 0) beatIntervals.push(time - lastBeat);
if (beatIntervals.length > 5) beatIntervals.shift();
lastBeat = time;
const sorted = beatIntervals.slice().sort((a, b) => a - b);
if (sorted.length) state.pulseRate = 60 / sorted[Math.floor(sorted.length / 2)];
}
wasAbove = above;
// Every half second: perfusion index and SpO2 from the pulse heights of the last 3 s
if (++count % Math.round(sampleRate / 2) === 0 && irPulse.length === windowSize) {
const acIr = range(irPulse);
const acRed = range(redPulse);
state.perfusionIndex = acIr; // already a % of the steady level
const ratio = acRed / acIr; // the "ratio of ratios" R
const reading = Math.min(100, Math.max(0, 110 - 25 * ratio));
state.spo2 = Number.isNaN(state.spo2) ? reading : state.spo2 + 0.15 * (reading - state.spo2); // averaged over a few seconds
}
return pleth;
};
return state;
}
// --- The charts: one sweeping trace each, with its own sweep speed ---
async function createTrace(div, options) {
const { sciChartSurface, wasmContext } = await SciChartSurface.create(div, { theme: new SciChartJsNavyTheme() });
const xAxis = new NumericAxis(wasmContext, {
axisTitle: "Time in sweep (s)",
autoRange: EAutoRange.Never,
labelPrecision: 0,
axisTitleStyle: { fontSize: 12 }
});
sciChartSurface.xAxes.add(xAxis);
sciChartSurface.yAxes.add(
new NumericAxis(wasmContext, {
axisTitle: options.title,
axisTitleStyle: { color: options.color, fontSize: 13 },
// A fixed CO2 scale keeps the numbers comparable; the pleth is auto-scaled, as monitors do
autoRange: options.range ? EAutoRange.Never : EAutoRange.Always,
visibleRange: options.range,
growBy: new NumberRange(0.1, 0.1),
labelPrecision: options.precision,
maxAutoTicks: options.range ? 8 : 4
})
);
const line = new FastLineRenderableSeries(wasmContext, {
stroke: options.color,
strokeThickness: 2,
pointMarker: new EllipsePointMarker(wasmContext, { width: 7, height: 7, fill: options.color, strokeThickness: 0, lastPointOnly: true })
});
sciChartSurface.renderableSeries.add(line);
sciChartSurface.chartModifiers.add(
new CursorModifier({ showTooltip: true, showYLine: false, showAxisLabels: false }),
new MouseWheelZoomModifier({ xyDirection: EXyDirection.XDirection }),
new ZoomPanModifier({ xyDirection: EXyDirection.XDirection }),
new ZoomExtentsModifier({ xyDirection: EXyDirection.XDirection })
);
const trace = { sciChartSurface, xAxis, line, capacity: 0, written: 0, seconds: 0, dataSeries: null, setSweepSpeed: null, append: null };
// Sweep mode: fifoSweeping makes the buffer wrap around, so new points overwrite the oldest from left
// to right, with a small gap ahead of the write point
trace.setSweepSpeed = (mmPerSecond, history) => {
trace.seconds = TRACE_WIDTH_MM / mmPerSecond;
trace.capacity = Math.round(trace.seconds * SAMPLE_RATE);
const old = trace.dataSeries;
trace.dataSeries = new XyDataSeries(wasmContext, {
dataSeriesName: options.name,
fifoCapacity: trace.capacity,
fifoSweeping: true,
fifoSweepingGap: Math.round(SAMPLE_RATE * trace.seconds * 0.02),
isSorted: false,
containsNaN: false
});
line.dataSeries = trace.dataSeries;
if (old) old.delete();
trace.written = 0;
xAxis.visibleRange = new NumberRange(0, trace.seconds);
trace.append(history.slice(-trace.capacity)); // redraw the latest screenful from the monitor's memory
};
trace.append = (values) => {
const xValues = values.map((_, i) => ((trace.written + i) % trace.capacity) / SAMPLE_RATE);
trace.written += values.length;
trace.dataSeries.appendRange(xValues, values);
};
return trace;
}
const capno = await createTrace(ui.capnoDiv, { name: "CO₂ (mmHg)", title: "CO₂ (mmHg)", color: "#F6E05E", range: new NumberRange(0, 70), precision: 0 });
const pleth = await createTrace(ui.plethDiv, { name: "Pleth (% of light)", title: "Pleth", color: "#50C7E0", precision: 1 });
// --- Live data: run the simulated patient through the monitor algorithms ---
const capnometer = createCapnometer(10); // apnoea alarm after 10 s with no breath (a short demo setting)
const oximeter = createOximeter(SAMPLE_RATE);
const history = { co2: [], pleth: [] }; // the last 24 s, so a sweep speed change can redraw the screen
function runPatient(count) {
const co2Values = [];
const plethValues = [];
for (let i = 0; i < count; i++) {
const sample = patient.nextSample();
capnometer.add(sample.time, sample.co2);
co2Values.push(sample.co2);
plethValues.push(oximeter.add(sample.time, sample.ir, sample.red));
}
history.co2.push(...co2Values);
history.pleth.push(...plethValues);
for (const values of [history.co2, history.pleth]) {
if (values.length > 24 * SAMPLE_RATE) values.splice(0, values.length - 24 * SAMPLE_RATE);
}
return { co2Values, plethValues };
}
runPatient(30 * SAMPLE_RATE); // 30 s of warm-up, so the screen starts full and the numbers are settled
function showNumbers() {
const r = ui.readings;
const show = (value, digits = 0) => (Number.isFinite(value) ? value.toFixed(digits) : "--");
r.etco2.textContent = capnometer.apnoea ? "--" : show(capnometer.etco2);
r.rr.textContent = capnometer.apnoea ? "0" : show(capnometer.rate);
r.fico2.textContent = show(capnometer.inspired);
r.spo2.textContent = show(oximeter.spo2);
r.pr.textContent = show(oximeter.pulseRate);
r.pi.textContent = show(oximeter.perfusionIndex, oximeter.perfusionIndex < 1 ? 2 : 1);
r.alarm.textContent = capnometer.apnoea ? "APNOEA" : "";
}
function onSettingsChanged() {
patient.settings.breathing = ui.breathingSelect.value;
patient.settings.pleth = ui.plethSelect.value;
const notes = [NOTES[ui.breathingSelect.value]];
if (ui.plethSelect.value !== "normal") notes.push(NOTES[ui.plethSelect.value]);
ui.note.textContent = notes.join(" ");
}
ui.breathingSelect.addEventListener("change", onSettingsChanged);
ui.plethSelect.addEventListener("change", onSettingsChanged);
ui.co2SweepSelect.addEventListener("change", () => capno.setSweepSpeed(Number(ui.co2SweepSelect.value), history.co2));
ui.plethSweepSelect.addEventListener("change", () => pleth.setSweepSpeed(Number(ui.plethSweepSelect.value), history.pleth));
capno.setSweepSpeed(Number(ui.co2SweepSelect.value), history.co2);
pleth.setSweepSpeed(Number(ui.plethSweepSelect.value), history.pleth);
onSettingsChanged();
showNumbers();
// Pause: stop the sweep to zoom (mouse wheel), pan (drag) and read values (hover); double-click to reset
let paused = false;
function setPaused(value) {
paused = value;
ui.pauseButton.textContent = paused ? "Resume" : "Pause";
ui.pauseButton.style.background = paused ? "#50C7E0" : "transparent";
ui.pauseButton.style.color = paused ? "#14233C" : "#ffffff";
if (!paused) for (const trace of [capno, pleth]) trace.xAxis.visibleRange = new NumberRange(0, trace.seconds);
}
ui.pauseButton.addEventListener("click", () => setPaused(!paused));
for (const trace of [capno, pleth]) {
const root = trace.sciChartSurface.domChartRoot;
root.addEventListener("wheel", () => setPaused(true));
root.addEventListener("pointerdown", () => setPaused(true));
}
// Add the samples that have arrived since the last update, about 60 times a second
let lastTime = performance.now();
let carry = 0;
let frames = 0;
const timer = setInterval(() => {
const now = performance.now();
const due = Math.min(((now - lastTime) * SAMPLE_RATE) / 1000, SAMPLE_RATE / 4) + carry;
lastTime = now;
if (paused) return;
const count = Math.floor(due);
carry = due - count;
if (count === 0) return;
const { co2Values, plethValues } = runPatient(count);
capno.append(co2Values);
pleth.append(plethValues);
if (++frames % 15 === 0) showNumbers(); // update the numbers about four times a second
}, 16);
capno.sciChartSurface.addDeletable({ delete: () => clearInterval(timer) });
import { SciChartReact } from "scichart-react";
import {
SciChartSurface,
NumericAxis,
FastLineRenderableSeries,
XyDataSeries,
NumberRange,
EAutoRange,
SciChartJsNavyTheme,
CursorModifier
} from "scichart";
const SAMPLE_RATE = 100; // samples per second from your monitor
const SECONDS_ON_SCREEN = 24; // 6.25 mm/s on a 150 mm trace
// One sweeping trace. Pass a range for a fixed scale (CO2), or leave it out to auto-scale (pleth)
const makeSweepTrace = (channel: string, title: string, color: string, range?: NumberRange) =>
async (rootElement: string | HTMLDivElement) => {
const { wasmContext, sciChartSurface } = await SciChartSurface.create(rootElement, {
theme: new SciChartJsNavyTheme()
});
sciChartSurface.xAxes.add(
new NumericAxis(wasmContext, {
axisTitle: "Time in sweep (s)",
autoRange: EAutoRange.Never,
visibleRange: new NumberRange(0, SECONDS_ON_SCREEN)
})
);
sciChartSurface.yAxes.add(
new NumericAxis(wasmContext, {
axisTitle: title,
autoRange: range ? EAutoRange.Never : EAutoRange.Always,
visibleRange: range
})
);
const capacity = SECONDS_ON_SCREEN * SAMPLE_RATE;
const dataSeries = new XyDataSeries(wasmContext, {
fifoCapacity: capacity, // one screen of samples
fifoSweeping: true, // overwrite from left to right, like a monitor
fifoSweepingGap: SAMPLE_RATE / 2
});
sciChartSurface.renderableSeries.add(
new FastLineRenderableSeries(wasmContext, { dataSeries, stroke: color, strokeThickness: 2 })
);
sciChartSurface.chartModifiers.add(new CursorModifier({ showTooltip: true }));
// New samples from your monitor or device feed
let written = 0;
const unsubscribe = subscribeToYourWaveform(channel, (values: number[]) => {
const xValues = values.map((_, i) => ((written + i) % capacity) / SAMPLE_RATE);
written += values.length;
dataSeries.appendRange(xValues, values);
});
sciChartSurface.addDeletable({ delete: unsubscribe });
return { sciChartSurface };
};
const initCapnogram = makeSweepTrace("co2", "CO₂ (mmHg)", "#F6E05E", new NumberRange(0, 70));
const initPleth = makeSweepTrace("pleth", "Pleth", "#50C7E0");
export const PatientMonitorTraces = () => (
<div>
<SciChartReact initChart={initCapnogram} style={{ width: "100%", height: 200 }} />
<SciChartReact initChart={initPleth} style={{ width: "100%", height: 200 }} />
</div>
);
import { Component } from "@angular/core";
import { ScichartAngularComponent } from "scichart-angular";
import {
SciChartSurface,
NumericAxis,
FastLineRenderableSeries,
XyDataSeries,
NumberRange,
EAutoRange,
SciChartJsNavyTheme,
CursorModifier
} from "scichart";
const SAMPLE_RATE = 100; // samples per second from your monitor
const SECONDS_ON_SCREEN = 24; // 6.25 mm/s on a 150 mm trace
// One sweeping trace. Pass a range for a fixed scale (CO2), or leave it out to auto-scale (pleth)
const makeSweepTrace = (channel: string, title: string, color: string, range?: NumberRange) =>
async (rootElement: string | HTMLDivElement) => {
const { wasmContext, sciChartSurface } = await SciChartSurface.create(rootElement, {
theme: new SciChartJsNavyTheme()
});
sciChartSurface.xAxes.add(
new NumericAxis(wasmContext, {
axisTitle: "Time in sweep (s)",
autoRange: EAutoRange.Never,
visibleRange: new NumberRange(0, SECONDS_ON_SCREEN)
})
);
sciChartSurface.yAxes.add(
new NumericAxis(wasmContext, {
axisTitle: title,
autoRange: range ? EAutoRange.Never : EAutoRange.Always,
visibleRange: range
})
);
const capacity = SECONDS_ON_SCREEN * SAMPLE_RATE;
const dataSeries = new XyDataSeries(wasmContext, {
fifoCapacity: capacity, // one screen of samples
fifoSweeping: true, // overwrite from left to right, like a monitor
fifoSweepingGap: SAMPLE_RATE / 2
});
sciChartSurface.renderableSeries.add(
new FastLineRenderableSeries(wasmContext, { dataSeries, stroke: color, strokeThickness: 2 })
);
sciChartSurface.chartModifiers.add(new CursorModifier({ showTooltip: true }));
// New samples from your monitor or device feed
let written = 0;
const unsubscribe = subscribeToYourWaveform(channel, (values: number[]) => {
const xValues = values.map((_, i) => ((written + i) % capacity) / SAMPLE_RATE);
written += values.length;
dataSeries.appendRange(xValues, values);
});
sciChartSurface.addDeletable({ delete: unsubscribe });
return { sciChartSurface };
};
@Component({
selector: "app-patient-monitor-traces",
standalone: true,
imports: [ScichartAngularComponent],
template: `
<scichart-angular [initChart]="initCapnogram" style="display: block; width: 100%; height: 200px"></scichart-angular>
<scichart-angular [initChart]="initPleth" style="display: block; width: 100%; height: 200px"></scichart-angular>
`
})
export class PatientMonitorTracesComponent {
// scichart-angular creates each chart, sizes it and cleans it up
initCapnogram = makeSweepTrace("co2", "CO₂ (mmHg)", "#F6E05E", new NumberRange(0, 70));
initPleth = makeSweepTrace("pleth", "Pleth", "#50C7E0");
}
Key points:
- Each trace is a
FastLineRenderableSeriesover anXyDataSerieswithfifoCapacityset to one screen of samples andfifoSweeping: true, so new points overwrite the oldest from left to right.fifoSweepingGapleaves a short blank ahead of the write point, as monitors do. - The x-values wrap back to zero at the end of each sweep (
written % capacity), and the x-axis stays fixed at the sweep window. Changing the sweep speed means a new data series with a new capacity. - The CO₂ y-axis has a fixed
visibleRangein mmHg; the pleth y-axis usesEAutoRange.Always, the chart's equivalent of a monitor's auto-gain. - The capnometer and oximeter functions show how the numbers come from the waveforms: breath detection with two thresholds, EtCO₂ as the peak of each breath, and SpO₂ from the ratio of the red and infrared pulse heights.
See it in the demo app: JavaScript ECG vital signs chart · React ECG vital signs chart · Angular ECG vital signs chart.
Go deeper: SciChart.js line series documentation and real-time updates documentation, which covers sweeping FIFO series. For how medical device makers and researchers use SciChart, see SciChart for medical charts and dashboards and SciChart for telehealth.
Frequently asked questions
What does a normal capnography waveform look like?
A normal capnogram repeats the same squared-off shape with every breath. It sits on a flat baseline at zero during inspiration, rises steeply when exhaled gas from the lungs reaches the sensor, runs along a nearly flat plateau that climbs slightly, and drops steeply back to zero when the next breath in begins. The value at the end of the plateau is the end-tidal CO2.
What is a normal EtCO2?
In adults with healthy lungs, end-tidal CO2 is normally 35 to 45 mmHg, or about 4.7 to 6.0 kPa. It usually reads a few mmHg below the arterial CO2 level. A higher value suggests hypoventilation or rebreathing; a lower value suggests hyperventilation, poor blood flow to the lungs or a leak in the sampling system.
What does a shark fin capnogram mean?
A shark fin capnogram has a slow, curved rise and a plateau that keeps sloping upwards instead of levelling off. It means the lungs are emptying unevenly because some airways are narrowed, as in bronchospasm, asthma or COPD. A partly blocked or kinked breathing tube can give a similar shape.
What is a pleth waveform on a pulse oximeter?
The pleth waveform, short for plethysmograph, is the pulse oximeter's trace of how much light the blood in a finger or earlobe absorbs from moment to moment. It rises with each heartbeat as arterial blood swells the tissue. A clean, regular pleth with a sharp upstroke shows the sensor is picking up a real pulse, which is the first check before believing the SpO2 and pulse rate. It doesn't rule out every error: carbon monoxide and skin pigmentation, for example, can make SpO2 read high behind a normal-looking pleth.
What is the difference between capnography and pulse oximetry?
Capnography measures carbon dioxide in exhaled breath, so it shows ventilation, the movement of air in and out of the lungs, breath by breath. Pulse oximetry measures the oxygen saturation of arterial blood, so it shows oxygenation. Capnography shows a stopped or slowed breath within seconds, while SpO2 can stay normal for minutes, especially when the patient is breathing extra oxygen.
How do I draw a capnogram or pleth waveform in JavaScript?
Use a line series with a first-in, first-out data buffer sized to one screen of samples, and set it to sweep, so new points overwrite the old ones from left to right as on a bedside monitor. Give the CO2 trace a fixed y-axis in mmHg and auto-scale the pleth trace. SciChart.js does this with FastLineRenderableSeries and an XyDataSeries using fifoCapacity and fifoSweeping.
Sources
- Bhavani-Shankar, K. and Philip, J. H. (2000), Defining segments and phases of a time capnogram. Anesthesia & Analgesia, 91(4). Phases 0, I, II and III (and IV), and the alpha and beta angles.
- Siobal, M. S. (2016), Monitoring exhaled carbon dioxide. Respiratory Care, 61(10). Capnometry and capnography, mainstream and sidestream sensors, normal values, the arterial to end-tidal gradient and abnormal waveforms.
- Kodali, B. S. (2013), Capnography outside the operating rooms. Anesthesiology, 118(1). Uses in sedation, emergency care and resuscitation, and abnormal capnograms.
- American Society of Anesthesiologists, Standards for Basic Anesthetic Monitoring (amended 2025). End-tidal CO₂ monitoring with a breathing tube or supraglottic airway in place, and during general anaesthesia and moderate or deep sedation.
- Wigginton, J. G. et al. (2025), Part 9: Adult advanced life support: 2025 American Heart Association guidelines for cardiopulmonary resuscitation and emergency cardiovascular care. Circulation, 152(16 suppl 2). Waveform capnography for tube placement and during CPR.
- Royal College of Physicians (2017), National Early Warning Score (NEWS) 2. Respiratory rate scoring bands.
- ISO 80601-2-55:2018 with Amd 1:2023: Medical electrical equipment, particular requirements for respiratory gas monitors; ISO 80601-2-61:2026: particular requirements for pulse oximeter equipment, including the controlled desaturation study used for calibration.
- Nitzan, M., Romem, A. and Koppel, R. (2014), Pulse oximetry: fundamentals and technology update. Medical Devices: Evidence and Research, 7. Red and infrared absorption, the ratio of ratios and calibration.
- Allen, J. (2007), Photoplethysmography and its application in clinical physiological measurement. Physiological Measurement, 28(3). The PPG waveform, the dicrotic notch and sources of artefact.
- Lima, A. P., Beelen, P. and Bakker, J. (2002), Use of a peripheral perfusion index derived from the pulse oximetry signal as a noninvasive indicator of perfusion. Critical Care Medicine, 30(6).
- Fu, E. S., Downs, J. B., Schweiger, J. W., Miguel, R. V. and Smith, R. A. (2004), Supplemental oxygen impairs detection of hypoventilation by pulse oximetry. Chest, 126(5).
- Sjoding, M. W., Dickson, R. P., Iwashyna, T. J., Gay, S. E. and Valley, T. S. (2020), Racial bias in pulse oximetry measurement. New England Journal of Medicine, 383.
- National Institute of Standards and Technology, How do you measure blood oxygen levels? Normal saturation range and the effect of skin pigmentation.