Container Utilisation · developer handoff

FCL button and container animation

The two new pieces of the shipment's Overview card. The FCL button sits in the card's header and shows how full the container is; clicking it opens the utilisation popover, where the 3D container loads. Each is one small file with no libraries, and neither needs anything else from the prototype.

The button in the shipment's Overview header: the mode, a small container, and the percentage used. That's the higher of space and weight used, and the fill follows it too. One small file works it out from the cargo's volume and weight and draws it. Clicking it opens the utilisation popover, whose container is in the Container animation tab.

fcl-unit.js No libraries · plain JavaScript and SVG

Overview

The container at 6× size

Shipment
Or set it, on a 40' HQ
22%
8%

Hover or tab to the button for its tooltip. Click it to see the open state; in the product that opens the utilisation popover.

Every case

Drawn by fcl-unit.js from the cargo of a 40' HQ (76 CBM, 26,500 kg max), except where it says otherwise.

States

Rules

WhatRule
Space usedCargo CBM ÷ (containers × capacity). Capacity is the container's nominal inside volume: 33 CBM for a 20' GP, 67 for a 40' GP, 76 for a 40' HQ.
Weight usedCargo kg ÷ (containers × max payload): 28,200 kg for a 20' GP, 26,700 for a 40' GP, 26,500 for a 40' HQ.
PercentageThe higher of space used and weight used, rounded, since a container is full when either runs out. With 40% space and 60% weight it reads 60%. Anything above 0 and under 1% reads “<1%”. Not capped, so an overfilled container can read above 100%.
Fill length17.2 × the percentage shown ÷ 100, in the container's 26 × 14 units, starting at x 2.3. It stops at 100%, at the door line.
Fill colourAlways #7681FC, the Analytics page's volume colour, at any percentage and also when weight is the higher figure. It doesn't change with how full the container is. In the popover the Volume bar uses the same colour and the Weight bar uses #F9B474, the Analytics weight colour.
Weight-limitedWeight at 90% of max payload or more: a “Weight-limited” chip follows the button.
Not known yetNo cargo volume yet: an empty container and a grey “—”. The tooltip says “Space used not known yet”.
TooltipOn hover or keyboard focus, under the button with the right edges lined up. One line, in regular weight like the carbon tooltip beside it: “49% of space used”. When weight is higher it names weight instead: “60% of weight limit used”. Hidden while the popover is open.
Screen readersThe button reads “FCL, 49% of container space used”, “FCL, 60% of weight limit used”, or “FCL, space used not known yet”. The container drawing is hidden from them.
ClickOpens the utilisation popover (see Container animation), whose big figure is the same percentage. Set aria-expanded="true" on the button while it's open; that gives it the white shape and hides the tooltip. The white is made for the lavender Overview header (#EBEDFF), so it won't show on a white background.

Use it

<!-- or import it with your bundler -->
<script src="fcl-unit.js"></script>

el.innerHTML = FclUnit.button({
  mode: 'FCL', type: '40HQ',
  containers: 1, cbm: 37, kg: 1000            // cbm or kg can be null until known
});

el.querySelector('[data-fcl]').addEventListener('click', e => {
  e.currentTarget.setAttribute('aria-expanded', 'true');  // and open your popover
});
button(shipment)
The whole button as an HTML string: “FCL”, the container, the percentage and the tooltip, with the “Weight-limited” chip after it when the cargo is heavy. Put it in a flex row; the product's header row has an 8px gap.
glyph(space, weight)
Just the 26 × 14 container as an SVG string. Both are percentages from 0 to 100, and the fill follows the higher; pass null for space when it isn't known. Use it wherever the container shows on its own.
measure(shipment)
The numbers behind it: space and weight used and the rounded text for each, which one is higher and the figure shown (used, usedText, byWeight), the capacities, and whether it's weight-limited. Use it if you draw the button in your own components.
capacity, thresholds, colors, css
The capacity table (add your other container types to it), the 90% weight-limited line, the colours and the styles. The styles are added to the page the first time it draws.
  • The button takes the page's font. The product uses Inter: 14px semibold, #111, with figures that line up (tabular-nums).
  • In React or Vue, render the string with dangerouslySetInnerHTML or v-html, or rebuild the markup in your own component from measure() and glyph(). The class names all start with fcl-.
  • The product has one container per shipment, so containers is 1. The sum already allows for more.
Show the code
Loading…

Without JavaScript

The container is one fixed SVG with one value to fill in: the fill's width, from the higher of space and weight used. Use this if your stack draws icons another way.

<svg viewBox="0 0 26 14" width="26" height="14" aria-hidden="true">
  <rect x=".75" y=".75" width="24.5" height="12.5" rx="1.4" fill="#FFFFFF" stroke="#1E1E1E" stroke-width="1.3"/>
  <rect x="2.3" y="2.3" width="{17.2 × higher % ÷ 100}" height="9.4" rx=".6" fill="#7681FC"/>
  <path d="M6.3 2.6v8.8M10.3 2.6v8.8M14.3 2.6v8.8" stroke="#1E1E1E" stroke-opacity=".18" stroke-width="1"/>
  <path d="M20.3 1.4v11.2" stroke="#1E1E1E" stroke-width="1.1"/>
  <path d="M22.4 3.4v7.2" stroke="#1E1E1E" stroke-width="1.1" stroke-linecap="round"/>
</svg>

Shape and colours

Size
26 × 14 px, one size everywhere. 6px from “FCL” and from the percentage.
Body
White, with a 1.3px #1E1E1E outline and 1.4px corners.
Fill
9.4px tall, 0.6px corners, from the front wall toward the doors.
Wall ridges
Three 1px lines at x 6.3, 10.3 and 14.3, #1E1E1E at 18%. They show through the fill.
Doors
A 1.1px door line at x 20.3 and a rounded 1.1px rod at x 22.4.