Back to the library

Unit chart — partial mark, clipped not shrunk

Variant: Partial mark

An isotype row where each mark is worth ten, built on the oldest rule of pictorial statistics: marks are counted, never scaled. At 47, the remainder is the fifth mark inked seven tenths of the way across with a hard clip edge, inside the outline of the whole — a mark drawn smaller reads as a smaller whole, and a reader compares areas long before they read a legend. The outline appears the instant its first unit does, so the fraction is always of something visible. Open and closed marks share one ink, because a remainder in a second colour reads as a second category; the open one differs only by its hard clip edge against the outline. The value enters to 47 on 700ms of ease-out, then revises to 62 on 560ms of ease-in-out — the fifth mark completes, a sixth fills, a seventh opens — because a revision moves a value already on screen and the reader already knows where to look. All seven slots are reserved, so the row never reflows. Reach for it on stat blocks and reports where totals are counts of real things.

datachartcounterclip-pathloop

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Unit chart — partial mark</title>
    <style>
      :root {
        /* Neutrals — fixed, never remixed. */
        --ivory: #faf9f5;
        --paper: #ffffff;
        --oat: #e3dacc;
        --slate: #141413;

        /* Knobs — the remix API. A knob exists iff declared here and used below. */
        --hue: 38.8;
        --lift: 0;
        --chroma: 1;
        --round: 1;
        --speed: 1;

        /* Accents — derived from the knobs with the family's offsets baked in,
           so one hue roll moves them together. Defaults reproduce the original hex. */
        --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
        --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
        --olive: oklch(
          calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
        );
        --rust: oklch(
          calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
        );

        --_muted: color-mix(in srgb, var(--slate) 52%, transparent);
        --_outline: color-mix(in oklab, var(--slate) 24%, transparent);

        /* Clock — 7s, so 1% is 70ms. The value enters to 47 over 700ms, holds,
           revises to 62 over 560ms, and holds again: a chart is read at rest. */
        --cycle: 7s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
      }

      @property --_p {
        syntax: '<number>';
        inherits: true;
        initial-value: 0;
      }

      @property --_n {
        syntax: '<integer>';
        inherits: true;
        initial-value: 0;
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: var(--ivory);
        font-family:
          system-ui,
          -apple-system,
          'Segoe UI',
          Roboto,
          sans-serif;
        color: var(--slate);
      }

      .chart {
        --_s: clamp(20px, 7vw, 32px);
        --_gap: calc(var(--_s) * 0.3);
        display: grid;
        gap: clamp(10px, 3vh, 14px);
        animation:
          value var(--t) infinite,
          scene-reset var(--t) infinite;
      }

      .count {
        font-size: clamp(20px, 7vh, 26px);
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        letter-spacing: -0.01em;
        counter-reset: n var(--_n);
      }

      .count::before {
        content: counter(n);
      }

      .count span {
        font-size: 12px;
        font-weight: 500;
        color: var(--_muted);
        margin-left: 4px;
        letter-spacing: 0;
      }

      .row {
        display: flex;
        gap: var(--_gap);
        /* Reserves all seven slots so the row never reflows as marks arrive. */
        width: calc(7 * var(--_s) + 6 * var(--_gap));
      }

      /* Every mark is the same size forever. A value is shown by how many
         there are, and the remainder by how much of the last one is inked —
         never by drawing a smaller mark, which reads as a smaller whole. */
      .tile {
        --_f: clamp(0, (var(--_p) - var(--_i) * 10) / 10, 1);
        position: relative;
        width: var(--_s);
        height: var(--_s);
        border-radius: calc(4px * var(--round));
        /* The whole appears the instant its first unit does, so 7 reads as
           seven tenths of something visible rather than a stub. */
        box-shadow: inset 0 0 0 1.5px var(--_outline);
        opacity: clamp(0, (var(--_p) - var(--_i) * 10) * 4, 1);
      }

      .tile i {
        position: absolute;
        inset: 0;
        border-radius: inherit;
      }

      /* One ink for every mark, open or closed: a remainder in a second
         colour reads as a second category. The open mark differs only by its
         hard clip edge against the outline of its whole. */
      .part {
        background: var(--slate);
        clip-path: inset(0 calc((1 - var(--_f)) * 100%) 0 0);
      }

      .key {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        color: var(--_muted);
      }

      .key::before {
        content: '';
        width: 11px;
        height: 11px;
        border-radius: calc(2px * var(--round));
        background: var(--slate);
      }

      /* Entering from nothing is a frame arriving, so ease-out. The revision
         moves a value already on screen from A to B, so ease-in-out, and
         shorter, because the reader already knows where to look. */
      @keyframes value {
        0%,
        6% {
          --_p: 0;
          --_n: 0;
          animation-timing-function: var(--ease-out);
        }
        16%,
        48% {
          --_p: 47;
          --_n: 47;
          animation-timing-function: var(--ease-in-out);
        }
        56%,
        93% {
          --_p: 62;
          --_n: 62;
          animation-timing-function: steps(1, end);
        }
        94%,
        100% {
          --_p: 0;
          --_n: 0;
        }
      }

      @keyframes scene-reset {
        0%,
        88% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        93%,
        97% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        100% {
          opacity: 1;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The clip is a reveal in place, not travel, so it stays; the whole
           cycle runs at double length so the wipe is a slow ink rather than
           a sweep. */
        .chart {
          animation-duration: calc(var(--t) * 2);
        }
      }
    </style>
  </head>
  <body>
    <div class="chart">
      <div class="count" aria-hidden="true"><span>loads</span></div>
      <div
        class="row"
        role="img"
        aria-label="A row of square marks, each worth ten. The value enters at 47 — four solid marks and a fifth inked seven tenths across — then revises to 62: the fifth mark completes, a sixth fills, and a seventh is inked two tenths across"
      >
        <div class="tile" style="--_i: 0"><i class="part"></i></div>
        <div class="tile" style="--_i: 1"><i class="part"></i></div>
        <div class="tile" style="--_i: 2"><i class="part"></i></div>
        <div class="tile" style="--_i: 3"><i class="part"></i></div>
        <div class="tile" style="--_i: 4"><i class="part"></i></div>
        <div class="tile" style="--_i: 5"><i class="part"></i></div>
        <div class="tile" style="--_i: 6"><i class="part"></i></div>
      </div>
      <div class="key" aria-hidden="true">= 10 loads</div>
    </div>
  </body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.