Charts and data graphics
ConfirmedThe specified chart palette and chart components, legible on a phone and in print.
Primary render. Select it to open full size.
Every render from the champion round
How to use it, from the piece README
Charts, stat tiles, before-and-after comparisons, and step diagrams for client reports, proposals, internal apps, and anything else that shows a number. Plain CSS and plain JavaScript. No library, no build step, nothing to install.
What is in here
| File | What it is |
|---|---|
charts.css | Chart styles. Every colour is a token from tokens.css. |
charts.js | Draws the charts. No backticks and no dollar-brace, so it pastes into a String.raw page. |
specimen.html | The palette, the order of use, live contrast checks, every chart type, the guardrails, and the rules. |
report.html | A real-shaped monthly lead report for a roofing client. Phone layout under 800px, Letter pages when printed. |
report.css, specimen.css | Page styles for those two files. |
renders/ | primary.png (specimen), phone.png (report at 390px), report.pdf and letter/p01.png to p04.png (Letter at 150dpi). |
Put it in an app or a document
- Copy
tokens.css,fonts/, andlogos/from the token layer, pluscharts.cssandcharts.js, into the app's static folder. Copy, never hotlink. - In the head, load
tokens.css, thencharts.css, then<script src="charts.js" defer></script>. - Drop in a figure. The script finds every
data-mccelement and draws it once fonts have loaded.
Snippet
<figure class="mcc" data-mcc="bar">
<p class="mcc-eyebrow">Lead sources</p>
<h3 class="mcc-title">Local Services Ads brought in 74 of 212 leads</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Source: PaceCRM, September 1 to 30, 2026.</figcaption>
<script type="application/json">
{"share": true, "data": [
{"label": "Google Local Services Ads", "value": 74, "highlight": true},
{"label": "Google Search Ads", "value": 52},
{"label": "Meta Ads", "value": 41}
]}
</script>
</figure>To change a chart, edit the words and numbers inside the JSON block. That is the only part you touch.
The seven types
data-mcc | Use it for | JSON it takes |
|---|---|---|
bar | Ranking things. Leads by channel, hours by service. | data list of label, value, optional highlight. share: true adds the percentage. |
line | Change over time. Cost per lead by month. | categories, series list of name, values, optional highlight. Optional annotations. |
stacked | Parts of a total over time. Four series at most. | categories, series. focus: "last" puts the newest total in red. |
donut | Parts of one whole. Four parts at most, and only when a bar would not do. | data, optional center with value and label. |
stat | One big number. Use on any div class="mcc". | value, label, optional format, unit, delta.text, delta.good, spark, highlight. |
compare | Before and after, one row per metric. | beforeLabel, afterLabel, rows with label, before, after, optional beforeText, afterText, changeText. |
steps | A process. How a lead moves through PaceCRM. | steps list of title, text, figure, optional highlight. |
Money and percentages: add "format": {"type": "money"} or {"type": "percent"}.
The palette, in order
--mc-data-1, Marathon Navy. The measure.--mc-data-2, Slate 500. The comparison.--mc-data-3, Gray 300. Context. Always labelled.--mc-data-4, Navy Soft. Only if four series are unavoidable.--mc-data-highlight, Marathon Red. The finding. One per chart.
On a navy panel add mcc--inverse to the figure. It switches to white tints and Red Bright, the only place Red Bright is allowed.
Rules the kit enforces for you
- A second
highlightis ignored and a small note says so. - A donut with more than four parts is drawn as bars instead.
- A line or stacked chart with more than four series is not drawn. A red box says why.
- Long labels wrap. Bars move their labels above the bar on a phone.
- Inside a Letter document (
html class="mc-doc") every chart switches to point sizes for print.
Rules you still own
- Write the title as the finding, not the topic.
- End every chart with a source line.
- Bars start at zero. Do not set
maxlower than the biggest value. - No shadows, gradients, 3D, or icons inside a chart.
For Jacob to confirm
Every number in report.html and specimen.html is example data shaped from a Houston roofing account. Replace it with the client's PaceCRM and ad platform exports before anything goes out.
Files to download and code to copy
- Whole piece, source files7 files, zip, 27.6 KB. Paths inside follow the repo layout, so put tokens.css beside them as the README says.Download
- report.pdfPDF, 507.2 KBDownload
Copy-paste code
charts.css239 lines, 11.2 KB
/* Marathon Creative chart kit, charts.css v1.0.0.
Load tokens.css first. Every colour below is a token, never a hex.
The chart palette, in order of use:
1 --mc-data-1 Marathon Navy. The measure.
2 --mc-data-2 Slate 500. Comparison or prior period.
3 --mc-data-3 Gray 300. Context and benchmark. Always carries a direct label.
4 --mc-data-4 Navy Soft. Only when four series are unavoidable, never next to series 1.
H --mc-data-highlight Marathon Red. The one thing the chart is about. One per chart.
Gridlines are horizontal only. No legends, no 3D, no shadows, no gradients. */
.mcc {
--mcc-1: var(--mc-data-1);
--mcc-2: var(--mc-data-2);
--mcc-3: var(--mc-data-3);
--mcc-4: var(--mc-data-4);
--mcc-hl: var(--mc-data-highlight);
--mcc-grid: var(--mc-data-gridline);
--mcc-axis: var(--mc-data-axis);
--mcc-sep: var(--mc-surface-page);
--mcc-ink: var(--mc-text-primary);
--mcc-ink-strong: var(--mc-text-heading);
--mcc-ink-soft: var(--mc-text-secondary);
--mcc-ink-faint: var(--mc-text-tertiary);
/* Series label colours. Series 3 is too light to read as type, so its label uses Slate 700. */
--mcc-t1: var(--mc-data-1);
--mcc-t2: var(--mc-data-2);
--mcc-t3: var(--mc-text-secondary);
--mcc-t4: var(--mc-data-4);
--mcc-thl: var(--mc-data-highlight);
--mcc-good: var(--mc-status-success);
--mcc-bad: var(--mc-status-error);
/* Geometry the script reads. */
--mcc-bar: var(--mc-space-05);
--mcc-row-gap: var(--mc-space-05);
--mcc-spark-h: var(--mc-space-08);
/* Type sizes, screen. */
--mcc-size-tick: var(--mc-type-eyebrow-size);
--mcc-size-label: var(--mc-type-caption-size);
--mcc-size-title: var(--mc-type-h3-size);
--mcc-size-center: var(--mc-type-h2-size);
--mcc-size-stat: var(--mc-type-stat-size);
margin: 0;
font-family: var(--mc-font);
color: var(--mcc-ink);
font-variant-numeric: var(--mc-numeric-tabular);
min-width: 0;
}
/* Inside a Letter document every chart switches to print sizes in points. */
.mc-doc .mcc {
--mcc-bar: var(--mc-space-04);
--mcc-row-gap: var(--mc-space-04);
--mcc-spark-h: var(--mc-space-07);
--mcc-plot-h: calc(var(--mc-space-14) + var(--mc-space-09));
--mcc-size-tick: var(--mc-print-type-caption-size);
--mcc-size-label: var(--mc-print-type-caption-size);
--mcc-size-title: var(--mc-print-type-h3-size);
--mcc-size-center: var(--mc-print-type-h2-size);
--mcc-size-stat: var(--mc-print-type-stat-size);
}
/* On a navy panel. Red Bright is allowed here and only here. */
.mcc--inverse {
--mcc-1: var(--mc-text-inverse);
--mcc-2: var(--mc-text-inverse-tertiary);
--mcc-3: var(--mc-border-inverse);
--mcc-4: var(--mc-text-inverse-secondary);
--mcc-hl: var(--mc-accent-on-inverse);
--mcc-grid: var(--mc-border-inverse);
--mcc-axis: var(--mc-text-inverse-tertiary);
--mcc-sep: var(--mc-surface-inverse);
--mcc-ink: var(--mc-text-inverse);
--mcc-ink-strong: var(--mc-text-inverse);
--mcc-ink-soft: var(--mc-text-inverse-secondary);
--mcc-ink-faint: var(--mc-text-inverse-tertiary);
--mcc-t1: var(--mc-text-inverse);
--mcc-t2: var(--mc-text-inverse-secondary);
--mcc-t3: var(--mc-text-inverse-secondary);
--mcc-t4: var(--mc-text-inverse-secondary);
--mcc-thl: var(--mc-text-inverse);
}
/* Figure furniture. The title states the finding, not the topic. */
.mcc-eyebrow {
margin: 0 0 var(--mc-space-02);
color: var(--mc-text-label);
font-size: var(--mcc-size-tick);
font-weight: var(--mc-type-eyebrow-weight);
letter-spacing: var(--mc-type-eyebrow-tracking);
text-transform: var(--mc-type-eyebrow-case);
line-height: var(--mc-type-eyebrow-leading);
}
.mcc--inverse .mcc-eyebrow { color: var(--mc-accent-on-inverse); }
.mcc-title {
margin: 0 0 var(--mc-space-05);
color: var(--mcc-ink-strong);
font-size: var(--mcc-size-title);
font-weight: var(--mc-type-h3-weight);
line-height: var(--mc-type-h3-leading);
max-width: 34em;
overflow-wrap: anywhere;
}
.mcc-plot { width: 100%; min-width: 0; }
.mcc-svg { display: block; overflow: visible; max-width: 100%; }
.mcc-source {
margin: var(--mc-space-04) 0 0;
padding-top: var(--mc-space-03);
border-top: var(--mc-border-width-hairline) solid var(--mcc-grid);
color: var(--mcc-ink-faint);
font-size: var(--mcc-size-tick);
font-weight: var(--mc-weight-regular);
line-height: var(--mc-type-caption-leading);
}
/* SVG marks. Fill classes. */
.mcc-f-1 { fill: var(--mcc-1); }
.mcc-f-2 { fill: var(--mcc-2); }
.mcc-f-3 { fill: var(--mcc-3); }
.mcc-f-4 { fill: var(--mcc-4); }
.mcc-f-hl { fill: var(--mcc-hl); }
.mcc-slice { stroke: var(--mcc-sep); stroke-width: var(--mc-border-width-strong); }
/* Lines. Stroke classes. */
.mcc-line { fill: none; stroke-width: var(--mc-border-width-strong); stroke-linejoin: round; stroke-linecap: round; }
.mcc-line-hl { stroke-width: var(--mc-border-width-bar); }
.mcc-k-1 { stroke: var(--mcc-1); }
.mcc-k-2 { stroke: var(--mcc-2); }
.mcc-k-3 { stroke: var(--mcc-3); }
.mcc-k-4 { stroke: var(--mcc-4); }
.mcc-k-hl { stroke: var(--mcc-hl); }
.mcc-mark { fill: var(--mcc-sep); stroke: var(--mcc-ink-strong); stroke-width: var(--mc-border-width-strong); }
/* Rules. Horizontal only. */
.mcc-grid { stroke: var(--mcc-grid); stroke-width: var(--mc-border-width-hairline); shape-rendering: crispEdges; }
.mcc-axis { stroke: var(--mcc-axis); stroke-width: var(--mc-border-width-hairline); shape-rendering: crispEdges; }
/* SVG text. Montserrat, tabular figures, always. */
.mcc-svg text { font-family: var(--mc-font); font-variant-numeric: var(--mc-numeric-tabular); }
.mcc-t-tick { font-size: var(--mcc-size-tick); font-weight: var(--mc-weight-regular); fill: var(--mcc-axis); }
.mcc-t-label { font-size: var(--mcc-size-label); font-weight: var(--mc-weight-semibold); fill: var(--mcc-ink); }
.mcc-t-value { font-size: var(--mcc-size-label); font-weight: var(--mc-weight-bold); fill: var(--mcc-ink-strong); }
.mcc-t-before { fill: var(--mcc-ink-soft); font-weight: var(--mc-weight-semibold); }
.mcc-t-share { font-size: var(--mcc-size-label); font-weight: var(--mc-weight-regular); fill: var(--mcc-ink-faint); }
.mcc-t-series { font-size: var(--mcc-size-label); font-weight: var(--mc-weight-bold); }
.mcc-t-note { font-size: var(--mcc-size-tick); font-weight: var(--mc-weight-semibold); fill: var(--mcc-ink-soft); }
.mcc-t-change { font-size: var(--mcc-size-label); font-weight: var(--mc-weight-bold); fill: var(--mcc-thl); }
.mcc-t-center { font-size: var(--mcc-size-center); font-weight: var(--mc-weight-extrabold); fill: var(--mcc-ink-strong); letter-spacing: var(--mc-type-stat-tracking); }
.mcc-t-1 { fill: var(--mcc-t1); }
.mcc-t-2 { fill: var(--mcc-t2); }
.mcc-t-3 { fill: var(--mcc-t3); }
.mcc-t-4 { fill: var(--mcc-t4); }
.mcc-t-hl, .mcc-is-hl { fill: var(--mcc-thl); }
.mcc-t-label.mcc-is-hl { font-weight: var(--mc-weight-bold); }
/* Stat tile. HTML, so long labels wrap like text. */
.mcc-stat {
--mcc-pad: 0px;
display: flex; flex-direction: column; gap: var(--mc-space-02);
padding-top: var(--mc-space-04);
border-top: var(--mc-border-width-bar) solid var(--mcc-1);
min-width: 0;
}
.mcc-stat--hl { border-top-color: var(--mcc-hl); }
.mcc-stat p { margin: 0; }
.mcc-stat-value {
color: var(--mcc-ink-strong);
font-size: var(--mcc-size-stat);
font-weight: var(--mc-type-stat-weight);
line-height: var(--mc-type-stat-leading);
letter-spacing: var(--mc-type-stat-tracking);
white-space: nowrap;
}
.mcc-stat-value--long { font-size: calc(var(--mcc-size-stat) * 0.72); }
.mcc-stat-unit { font-size: 0.42em; font-weight: var(--mc-weight-bold); letter-spacing: 0; }
.mcc-stat-label { color: var(--mcc-ink); font-size: var(--mcc-size-label); font-weight: var(--mc-weight-semibold); line-height: var(--mc-type-caption-leading); }
.mcc-stat-delta { font-size: var(--mcc-size-tick); font-weight: var(--mc-weight-bold); line-height: var(--mc-type-caption-leading); }
.mcc-stat-source { color: var(--mcc-ink-faint); font-size: var(--mcc-size-tick); line-height: var(--mc-type-caption-leading); }
.mcc-good { color: var(--mcc-good); }
.mcc-bad { color: var(--mcc-bad); }
.mcc--inverse .mcc-good, .mcc--inverse .mcc-bad { color: var(--mc-text-inverse); }
.mcc-spark { margin-top: var(--mc-space-02); }
.mcc-spark svg { display: block; overflow: visible; }
/* Explainer steps. One column on a phone, a row from 600px and in print. */
.mcc-steps {
list-style: none; margin: 0; padding: 0;
display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mc-space-05);
position: relative;
}
.mcc-step { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--mc-space-04); position: relative; }
.mcc-step:not(:last-child)::after {
content: ""; position: absolute;
left: calc(var(--mc-space-08) / 2 - var(--mc-border-width-strong) / 2);
top: var(--mc-space-08); bottom: calc(var(--mc-space-05) * -1);
width: var(--mc-border-width-strong); background: var(--mcc-grid);
}
.mcc-step-num {
width: var(--mc-space-08); height: var(--mc-space-08); border-radius: var(--mc-radius-pill);
display: inline-flex; align-items: center; justify-content: center;
background: var(--mcc-1); color: var(--mc-text-inverse);
font-size: var(--mcc-size-label); font-weight: var(--mc-weight-bold);
}
.mcc--inverse .mcc-step-num { color: var(--mc-text-heading); }
.mcc-step--hl .mcc-step-num { background: var(--mcc-hl); }
.mcc-step-body p { margin: 0; }
.mcc-step-title { color: var(--mcc-ink-strong); font-size: var(--mcc-size-label); font-weight: var(--mc-weight-bold); line-height: var(--mc-type-h3-leading); padding-top: var(--mc-space-02); }
.mcc-step-text { color: var(--mcc-ink-soft); font-size: var(--mcc-size-label); font-weight: var(--mc-weight-regular); line-height: var(--mc-type-caption-leading); margin-top: var(--mc-space-02) !important; }
.mcc-step-figure { color: var(--mcc-ink-strong); font-size: var(--mcc-size-label); font-weight: var(--mc-weight-extrabold); margin-top: var(--mc-space-03) !important; }
.mcc-step--hl .mcc-step-figure { color: var(--mcc-thl); }
@media (min-width: 600px) {
.mcc-steps { grid-template-columns: repeat(var(--mcc-step-count), minmax(0, 1fr)); gap: var(--mc-space-05); }
.mcc-step { grid-template-columns: minmax(0, 1fr); gap: var(--mc-space-03); }
.mcc-step:not(:last-child)::after {
left: calc(var(--mc-space-08) + var(--mc-space-03)); right: calc(var(--mc-space-05) * -1 + var(--mc-space-03));
top: calc(var(--mc-space-08) / 2 - var(--mc-border-width-strong) / 2); bottom: auto;
width: auto; height: var(--mc-border-width-strong);
}
}
/* Guardrail messages. Shown in the chart slot instead of a broken chart. */
.mcc-refuse {
padding: var(--mc-space-05);
border-left: var(--mc-border-width-bar) solid var(--mc-status-error);
background: var(--mc-status-error-surface);
color: var(--mc-text-primary);
font-size: var(--mcc-size-label); line-height: var(--mc-type-caption-leading);
}
.mcc-note {
margin: var(--mc-space-03) 0 0;
color: var(--mcc-ink-faint);
font-size: var(--mcc-size-tick); font-weight: var(--mc-weight-semibold);
}
@media print {
.mcc { break-inside: avoid; page-break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
charts.js576 lines, 26.2 KB
/* Marathon Creative chart kit, charts.js v1.0.0.
Plain JavaScript. No library, no build step, no framework.
Contains no backtick and no dollar-brace, so it can be pasted inside a String.raw page template.
Colours never live in this file. Every mark gets a class, and charts.css maps that class to a token.
Sizes for bars and rows are read from CSS custom properties on the figure, so print and phone
can differ without touching this file. */
(function (root) {
'use strict';
var NS = 'http://www.w3.org/2000/svg';
var MAX_SERIES = 4;
var MAX_SLICES = 4;
/* ---------- small helpers ---------- */
function svgEl(tag, attrs, parent) {
var n = document.createElementNS(NS, tag);
for (var k in attrs) { if (attrs[k] !== undefined && attrs[k] !== null) n.setAttribute(k, attrs[k]); }
if (parent) parent.appendChild(n);
return n;
}
function htmlEl(tag, cls, parent, text) {
var n = document.createElement(tag);
if (cls) n.className = cls;
if (text !== undefined && text !== null) n.textContent = text;
if (parent) parent.appendChild(n);
return n;
}
function clear(node) { while (node.firstChild) node.removeChild(node.firstChild); }
/* Read a length custom property in px. A probe resolves calc() and pt values. */
function cssNum(node, name, fallback) {
var raw = getComputedStyle(node).getPropertyValue(name).trim();
if (!raw) return fallback;
var probe = document.createElement('div');
probe.style.position = 'absolute';
probe.style.visibility = 'hidden';
probe.style.height = '0';
probe.style.width = 'var(' + name + ')';
node.appendChild(probe);
var w = probe.getBoundingClientRect().width;
node.removeChild(probe);
return w > 0 ? w : fallback;
}
function maxOf(arr) { var m = -Infinity; for (var i = 0; i < arr.length; i++) if (arr[i] > m) m = arr[i]; return m; }
function sum(arr) { var s = 0; for (var i = 0; i < arr.length; i++) s += arr[i]; return s; }
function clamp(v, lo, hi) { return Math.max(lo, Math.min(hi, v)); }
/* Numbers. Tabular figures come from CSS, this only formats. */
function fmt(v, f) {
if (typeof v === 'string') return v;
f = f || {};
var d = f.digits === undefined ? 0 : f.digits;
var n = Math.abs(v).toLocaleString('en-US', { minimumFractionDigits: d, maximumFractionDigits: d });
var sign = v < 0 ? '−' : '';
if (f.type === 'money') return sign + '$' + n;
if (f.type === 'percent') return sign + n + '%';
return sign + n + (f.suffix || '');
}
/* House style: spell out one to nine, numerals from 10. */
var WORDS = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
function count(n) { return n >= 0 && n < 10 ? WORDS[n] : String(n); }
function niceStep(range, count) {
var raw = range / Math.max(1, count);
var p = Math.pow(10, Math.floor(Math.log(raw) / Math.LN10));
var steps = [1, 2, 2.5, 5, 10];
for (var i = 0; i < steps.length; i++) if (steps[i] * p >= raw) return steps[i] * p;
return 10 * p;
}
/* Text measuring inside the live SVG, so the real font and the real CSS size are used. */
function measurer(svg) {
return function (txt, cls) {
var t = svgEl('text', { 'class': cls, x: 0, y: 0 }, svg);
t.textContent = txt;
var b = t.getBBox();
svg.removeChild(t);
return { w: b.width, h: b.height };
};
}
function wrap(m, text, cls, maxW) {
var words = String(text).split(' ');
var lines = [];
var cur = '';
for (var i = 0; i < words.length; i++) {
var test = cur ? cur + ' ' + words[i] : words[i];
if (!cur || m(test, cls).w <= maxW) cur = test;
else { lines.push(cur); cur = words[i]; }
}
if (cur) lines.push(cur);
return lines;
}
/* Draw one or more lines of text centred on y. Returns the text node. */
function text(svg, lines, x, y, cls, anchor, lh) {
if (typeof lines === 'string') lines = [lines];
var t = svgEl('text', { 'class': cls, x: x, 'text-anchor': anchor || 'start' }, svg);
var first = y - (lines.length - 1) * lh / 2;
for (var i = 0; i < lines.length; i++) {
var s = svgEl('tspan', { x: x, y: first + i * lh, dy: '0.35em' }, t);
s.textContent = lines[i];
}
return t;
}
/* Push direct labels apart so they never overlap, then pull them back inside the plot. */
function spread(items, top, bottom) {
items.sort(function (a, b) { return a.want - b.want; });
for (var i = 0; i < items.length; i++) {
items[i].y = items[i].want;
if (i > 0) {
var prev = items[i - 1];
var need = prev.y + prev.h / 2 + items[i].h / 2 + 2;
if (items[i].y < need) items[i].y = need;
}
}
var last = items[items.length - 1];
var over = last ? last.y + last.h / 2 - bottom : 0;
if (over > 0) {
for (var j = items.length - 1; j >= 0; j--) {
items[j].y -= over;
if (j > 0) {
var gap = items[j].y - items[j].h / 2 - (items[j - 1].y + items[j - 1].h / 2) - 2;
if (gap >= 0) break;
over = -gap;
}
}
}
if (items.length && items[0].y - items[0].h / 2 < top) {
var shift = top - (items[0].y - items[0].h / 2);
for (var k = 0; k < items.length; k++) items[k].y += shift;
}
return items;
}
function makeSvg(plot, w, label) {
clear(plot);
var svg = svgEl('svg', { width: w, height: 10, viewBox: '0 0 ' + w + ' 10', role: 'img', 'aria-label': label || 'Chart', 'class': 'mcc-svg' }, plot);
return svg;
}
function finish(svg, w, h) {
h = Math.ceil(h);
svg.setAttribute('height', h);
svg.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
}
function refuse(plot, msg) {
clear(plot);
var box = htmlEl('div', 'mcc-refuse', plot);
htmlEl('strong', null, box, 'Not drawn. ');
htmlEl('span', null, box, msg);
}
function note(plot, msg) { htmlEl('p', 'mcc-note', plot, msg); }
/* One highlight per chart. Extra highlight flags are dropped and reported. */
function oneHighlight(list) {
var seen = false, dropped = 0;
for (var i = 0; i < list.length; i++) {
if (list[i].highlight) { if (seen) { list[i].highlight = false; dropped++; } seen = true; }
}
return dropped;
}
function seriesClass(i) { return String(i + 1); }
/* ---------- horizontal bar ---------- */
function bar(plot, o) {
var data = o.data.map(function (d) { return { label: d.label, value: d.value, highlight: !!d.highlight }; });
var dropped = oneHighlight(data);
if (o.sort !== false) data.sort(function (a, b) { return b.value - a.value; });
var W = Math.floor(plot.clientWidth);
var svg = makeSvg(plot, W, o.label);
var m = measurer(svg);
var barH = cssNum(plot, '--mcc-bar', 16);
var rowGap = cssNum(plot, '--mcc-row-gap', 16);
var lh = m('Hg', 'mcc-t-label').h;
var total = sum(data.map(function (d) { return d.value; }));
var vals = data.map(function (d) { return fmt(d.value, o.format); });
var shares = data.map(function (d) { return o.share ? Math.round(d.value / total * 100) + '%' : ''; });
var valW = maxOf(vals.map(function (v, i) { return m(v, 'mcc-t-value').w + (o.share ? m(' ' + shares[i], 'mcc-t-share').w + 6 : 0); })) + 10;
var labelW = maxOf(data.map(function (d) { return m(d.label, 'mcc-t-label').w; }));
var above = W < 480 || labelW > W * 0.38;
var maxV = o.max || maxOf(data.map(function (d) { return d.value; }));
var x0 = 0, y = 0, rows = [];
if (!above) x0 = Math.ceil(Math.min(labelW, W * 0.38)) + 14;
var span = W - x0 - valW;
for (var i = 0; i < data.length; i++) {
var d = data[i];
var hl = d.highlight ? ' mcc-is-hl' : '';
var len = Math.max(2, d.value / maxV * span);
var lines, by;
if (above) {
lines = wrap(m, d.label, 'mcc-t-label', W - 4);
text(svg, lines, 0, y + lines.length * lh / 2, 'mcc-t-label' + hl, 'start', lh);
by = y + lines.length * lh + 4;
y = by + barH + rowGap;
} else {
lines = wrap(m, d.label, 'mcc-t-label', x0 - 14);
var rowH = Math.max(barH, lines.length * lh);
by = y + (rowH - barH) / 2;
text(svg, lines, 0, y + rowH / 2, 'mcc-t-label' + hl, 'start', lh);
y = y + rowH + rowGap * 0.75;
}
svgEl('rect', { x: x0, y: by, width: len, height: barH, 'class': d.highlight ? 'mcc-f-hl' : 'mcc-f-' + (o.series || 1) }, svg);
var vt = text(svg, vals[i], x0 + len + 6, by + barH / 2, 'mcc-t-value' + hl, 'start', lh);
if (o.share) { var sp = svgEl('tspan', { 'class': 'mcc-t-share', dx: 6 }, vt); sp.textContent = shares[i]; }
rows.push(by);
}
var bottom = y - (above ? rowGap : rowGap * 0.75);
if (!above) svgEl('line', { x1: x0 + 0.5, x2: x0 + 0.5, y1: 0, y2: bottom, 'class': 'mcc-axis' }, svg);
finish(svg, W, bottom + 2);
if (dropped) note(plot, 'One highlight per chart, so ' + count(dropped) + ' extra ' + (dropped > 1 ? 'highlights were' : 'highlight was') + ' ignored.');
}
/* ---------- stacked column ---------- */
function stacked(plot, o) {
if (o.series.length > MAX_SERIES) return refuse(plot, 'A stacked chart takes four series at most. This one has ' + count(o.series.length) + '. Group the small ones into Other, or split it into two charts.');
var W = Math.floor(plot.clientWidth);
var svg = makeSvg(plot, W, o.label);
var m = measurer(svg);
var lh = m('Hg', 'mcc-t-label').h;
var n = o.categories.length;
var last = n - 1;
var totals = o.categories.map(function (c, ci) { return sum(o.series.map(function (s) { return s.values[ci]; })); });
var maxT = maxOf(totals);
var labelMax = Math.min(W * 0.34, maxOf(o.series.map(function (s) { return m(s.name, 'mcc-t-series').w + m(' ' + fmt(s.values[last], o.format), 'mcc-t-value').w; })));
var right = Math.ceil(labelMax) + 12;
var top = lh + 8;
var plotH = o.height || cssNum(plot, '--mcc-plot-h', 0) || clamp(W * 0.42, 180, 280);
var base = top + plotH;
var band = (W - right) / n;
var colW = Math.min(band * 0.64, 56);
var gap = 2;
var lastSeg = [];
for (var ci = 0; ci < n; ci++) {
var cx = band * ci + band / 2;
var yb = base;
for (var si = 0; si < o.series.length; si++) {
var v = o.series[si].values[ci];
var h = v / maxT * plotH;
var hh = Math.max(0, h - (si > 0 ? gap : 0));
svgEl('rect', { x: cx - colW / 2, y: yb - h, width: colW, height: hh, 'class': 'mcc-f-' + seriesClass(si) }, svg);
if (ci === last) lastSeg.push({ mid: yb - h / 2 - (si > 0 ? gap / 2 : 0), si: si });
yb -= h;
}
var focus = o.focus === ci || (o.focus === 'last' && ci === last);
text(svg, fmt(totals[ci], o.format), cx, yb - lh / 2 - 4, 'mcc-t-value' + (focus ? ' mcc-is-hl' : ''), 'middle', lh);
}
svgEl('line', { x1: 0, x2: W - right + 4, y1: base + 0.5, y2: base + 0.5, 'class': 'mcc-axis' }, svg);
/* category labels, thinned so they never collide, last always kept */
var catW = maxOf(o.categories.map(function (c) { return m(c, 'mcc-t-tick').w; })) + 8;
var every = Math.max(1, Math.ceil(catW / band));
for (var k = 0; k < n; k++) {
if ((last - k) % every !== 0) continue;
text(svg, o.categories[k], band * k + band / 2, base + lh / 2 + 6, 'mcc-t-tick', 'middle', lh);
}
/* direct labels on the last column, no legend */
var lx = band * last + band / 2 + colW / 2 + 10;
var maxLabel = W - lx;
var items = lastSeg.map(function (seg) {
var s = o.series[seg.si];
var lines = wrap(m, s.name, 'mcc-t-series', maxLabel - m(' ' + fmt(s.values[last], o.format), 'mcc-t-value').w);
return { want: seg.mid, h: lines.length * lh, lines: lines, si: seg.si };
});
spread(items, top, base);
items.forEach(function (it) {
var t = text(svg, it.lines, lx, it.y, 'mcc-t-series mcc-t-' + seriesClass(it.si), 'start', lh);
var vs = svgEl('tspan', { 'class': 'mcc-t-value', dx: 6 }, t);
vs.textContent = fmt(o.series[it.si].values[last], o.format);
});
finish(svg, W, base + lh + 10);
}
/* ---------- line ---------- */
function line(plot, o) {
if (o.series.length > MAX_SERIES) return refuse(plot, 'A line chart takes four lines at most. This one has ' + count(o.series.length) + '. Show the four that matter and put the rest in a table.');
var series = o.series.map(function (s) { return { name: s.name, values: s.values, highlight: !!s.highlight }; });
var dropped = oneHighlight(series);
var W = Math.floor(plot.clientWidth);
var svg = makeSvg(plot, W, o.label);
var m = measurer(svg);
var lh = m('Hg', 'mcc-t-label').h;
var n = o.categories.length, last = n - 1;
var all = [];
series.forEach(function (s) { all = all.concat(s.values); });
var yMin = o.yMin === undefined ? 0 : o.yMin;
var step = niceStep(maxOf(all) - yMin, o.ticks || 4);
var yMax = Math.ceil(maxOf(all) / step) * step;
var ticks = [];
for (var t = yMin; t <= yMax + step / 1000; t += step) ticks.push(t);
var left = Math.ceil(maxOf(ticks.map(function (v) { return m(fmt(v, o.format), 'mcc-t-tick').w; }))) + 8;
var labelMax = Math.min(W * 0.32, maxOf(series.map(function (s) { return Math.max(m(s.name, 'mcc-t-series').w, m(fmt(s.values[last], o.format), 'mcc-t-value').w); })));
var right = Math.ceil(labelMax) + 14;
var top = lh;
var plotH = o.height || cssNum(plot, '--mcc-plot-h', 0) || clamp(W * 0.42, 170, 260);
var base = top + plotH;
var x = function (i) { return left + (W - left - right) * (n === 1 ? 0.5 : i / last); };
var y = function (v) { return base - (v - yMin) / (yMax - yMin) * plotH; };
ticks.forEach(function (tv) {
svgEl('line', { x1: left, x2: W - right + 4, y1: Math.round(y(tv)) + 0.5, y2: Math.round(y(tv)) + 0.5, 'class': tv === yMin ? 'mcc-axis' : 'mcc-grid' }, svg);
text(svg, fmt(tv, o.format), left - 8, y(tv), 'mcc-t-tick', 'end', lh);
});
var catW = maxOf(o.categories.map(function (c) { return m(c, 'mcc-t-tick').w; })) + 10;
var every = Math.max(1, Math.ceil(catW / ((W - left - right) / Math.max(1, last))));
for (var k = 0; k < n; k++) {
if ((last - k) % every !== 0) continue;
text(svg, o.categories[k], x(k), base + lh / 2 + 6, 'mcc-t-tick', 'middle', lh);
}
/* draw the context lines first, the highlighted line last so it sits on top */
var order = series.map(function (s, i) { return i; }).sort(function (a, b) { return (series[a].highlight ? 1 : 0) - (series[b].highlight ? 1 : 0) || b - a; });
order.forEach(function (si) {
var s = series[si];
var cls = s.highlight ? 'hl' : seriesClass(si);
var d = s.values.map(function (v, i) { return (i ? 'L' : 'M') + x(i).toFixed(1) + ' ' + y(v).toFixed(1); }).join(' ');
svgEl('path', { d: d, 'class': 'mcc-line mcc-k-' + cls + (s.highlight ? ' mcc-line-hl' : '') }, svg);
svgEl('circle', { cx: x(last), cy: y(s.values[last]), r: 3.5, 'class': 'mcc-f-' + cls }, svg);
});
(o.annotations || []).forEach(function (a) {
var s = series[a.series || 0];
var ax = x(a.index), ay = y(s.values[a.index]);
svgEl('circle', { cx: ax, cy: ay, r: 4, 'class': 'mcc-mark' }, svg);
var lines = wrap(m, a.text, 'mcc-t-note', Math.min(150, W * 0.4));
var tx = clamp(ax, left + 4, W - right - 4);
var anchor = ax < left + 40 ? 'start' : (ax > W - right - 60 ? 'end' : 'middle');
var below = a.below === true;
var ty = below ? ay + 12 + lines.length * lh / 2 : ay - 12 - lines.length * lh / 2;
text(svg, lines, anchor === 'start' ? ax - 4 : tx, ty, 'mcc-t-note', anchor, lh);
});
var items = series.map(function (s, si) {
return { want: y(s.values[last]), h: lh * 2, si: si };
});
spread(items, 0, base + lh);
items.forEach(function (it) {
var s = series[it.si];
var cls = s.highlight ? 'hl' : seriesClass(it.si);
text(svg, [s.name], x(last) + 10, it.y - lh / 2, 'mcc-t-series mcc-t-' + cls, 'start', lh);
text(svg, [fmt(s.values[last], o.format)], x(last) + 10, it.y + lh / 2, 'mcc-t-value' + (s.highlight ? ' mcc-is-hl' : ''), 'start', lh);
});
finish(svg, W, base + lh + 10);
if (dropped) note(plot, 'One highlighted line per chart, so ' + count(dropped) + ' extra ' + (dropped > 1 ? 'highlights were' : 'highlight was') + ' ignored.');
}
/* ---------- donut, used sparingly ---------- */
function donut(plot, o) {
var data = o.data.map(function (d) { return { label: d.label, value: d.value, highlight: !!d.highlight }; });
if (data.length > MAX_SLICES) {
bar(plot, { data: data, format: o.format, share: true, label: o.label });
note(plot, 'Shown as bars. A donut takes four parts at most, this one had ' + count(data.length) + '.');
return;
}
oneHighlight(data);
data.sort(function (a, b) { return b.value - a.value; });
var W = Math.floor(plot.clientWidth);
var svg = makeSvg(plot, W, o.label);
var m = measurer(svg);
var lh = m('Hg', 'mcc-t-label').h;
var total = sum(data.map(function (d) { return d.value; }));
var labelW = Math.min(W * 0.3, maxOf(data.map(function (d) { return m(d.label, 'mcc-t-label').w; })));
var size = clamp(W - 2 * (labelW + 22), 120, 220);
var r = size / 2, ri = r * 0.64;
var cx = W / 2, cy = r + lh * 1.5;
var a0 = -Math.PI / 2;
var ctx = 0;
var labels = [];
data.forEach(function (d) {
var a1 = a0 + d.value / total * Math.PI * 2;
var large = a1 - a0 > Math.PI ? 1 : 0;
var p = [
'M', cx + r * Math.cos(a0), cy + r * Math.sin(a0),
'A', r, r, 0, large, 1, cx + r * Math.cos(a1), cy + r * Math.sin(a1),
'L', cx + ri * Math.cos(a1), cy + ri * Math.sin(a1),
'A', ri, ri, 0, large, 0, cx + ri * Math.cos(a0), cy + ri * Math.sin(a0), 'Z'
].join(' ');
var cls = d.highlight ? 'hl' : String(++ctx);
svgEl('path', { d: p, 'class': 'mcc-f-' + cls + ' mcc-slice' }, svg);
var mid = (a0 + a1) / 2;
labels.push({ d: d, mid: mid, cls: cls });
a0 = a1;
});
var cvals = o.center || { value: fmt(total, o.format), label: 'Total' };
text(svg, cvals.value, cx, cy - lh * 0.45, 'mcc-t-center', 'middle', lh);
text(svg, cvals.label, cx, cy + lh * 0.95, 'mcc-t-tick', 'middle', lh);
var sides = { left: [], right: [] };
labels.forEach(function (L) {
var side = Math.cos(L.mid) >= 0 ? 'right' : 'left';
var lines = wrap(m, L.d.label, 'mcc-t-label', labelW);
sides[side].push({ want: cy + (r + 8) * Math.sin(L.mid), h: (lines.length + 1) * lh, lines: lines, L: L, side: side });
});
['left', 'right'].forEach(function (side) {
spread(sides[side], 0, cy + r + lh * 2);
sides[side].forEach(function (it) {
var xx = side === 'right' ? cx + r + 14 : cx - r - 14;
var anchor = side === 'right' ? 'start' : 'end';
var hl = it.L.d.highlight ? ' mcc-is-hl' : '';
var topY = it.y - it.h / 2 + lh / 2;
text(svg, it.lines, xx, topY + (it.lines.length - 1) * lh / 2, 'mcc-t-label' + hl, anchor, lh);
var vt = text(svg, fmt(it.L.d.value, o.format), xx, topY + it.lines.length * lh, 'mcc-t-value' + hl, anchor, lh);
var sp = svgEl('tspan', { 'class': 'mcc-t-share', dx: 6 }, vt);
sp.textContent = Math.round(it.L.d.value / total * 100) + '%';
});
});
finish(svg, W, cy + r + lh * 1.5);
}
/* ---------- stat tile ---------- */
function stat(node, o) {
clear(node);
node.classList.add('mcc-stat');
if (o.highlight) node.classList.add('mcc-stat--hl');
var v = fmt(o.value, o.format);
var val = htmlEl('p', 'mcc-stat-value', node, v);
if (v.length > 6) val.classList.add('mcc-stat-value--long');
if (o.unit) htmlEl('span', 'mcc-stat-unit', val, ' ' + o.unit);
htmlEl('p', 'mcc-stat-label', node, o.label);
if (o.delta) {
var good = o.delta.good !== false;
htmlEl('p', 'mcc-stat-delta ' + (good ? 'mcc-good' : 'mcc-bad'), node, o.delta.text);
}
if (o.spark && o.spark.length > 1) {
var W = Math.max(60, Math.floor(node.clientWidth - cssNum(node, '--mcc-pad', 0) * 2));
var H = cssNum(node, '--mcc-spark-h', 28);
var holder = htmlEl('div', 'mcc-spark', node);
var svg = svgEl('svg', { width: W, height: H, viewBox: '0 0 ' + W + ' ' + H, role: 'img', 'aria-label': 'Trend' }, holder);
var lo = Math.min.apply(null, o.spark), hi = Math.max.apply(null, o.spark);
var px = function (i) { return 4 + (W - 8) * i / (o.spark.length - 1); };
var py = function (vv) { return H - 4 - (vv - lo) / Math.max(1e-9, hi - lo) * (H - 8); };
var d = o.spark.map(function (vv, i) { return (i ? 'L' : 'M') + px(i).toFixed(1) + ' ' + py(vv).toFixed(1); }).join(' ');
svgEl('path', { d: d, 'class': 'mcc-line mcc-k-2' }, svg);
var li = o.spark.length - 1;
svgEl('circle', { cx: px(li), cy: py(o.spark[li]), r: 3, 'class': 'mcc-f-hl' }, svg);
}
if (o.source) htmlEl('p', 'mcc-stat-source', node, o.source);
}
/* ---------- comparison, before and after ---------- */
function compare(plot, o) {
var W = Math.floor(plot.clientWidth);
var svg = makeSvg(plot, W, o.label);
var m = measurer(svg);
var lh = m('Hg', 'mcc-t-label').h;
var barH = cssNum(plot, '--mcc-bar', 16);
var rowGap = cssNum(plot, '--mcc-row-gap', 16);
var tagW = Math.ceil(Math.max(m(o.beforeLabel, 'mcc-t-tick').w, m(o.afterLabel, 'mcc-t-tick').w)) + 12;
var y = 0;
o.rows.forEach(function (r, ri) {
var bt = r.beforeText || fmt(r.before, r.format || o.format);
var at = r.afterText || fmt(r.after, r.format || o.format);
var change = r.changeText;
if (!change) {
var pct = Math.round(Math.abs(r.after - r.before) / r.before * 100);
change = pct + '% ' + (r.after < r.before ? 'lower' : 'higher');
}
var chW = m(change, 'mcc-t-change').w;
var lines = wrap(m, r.label, 'mcc-t-label', W - chW - 16);
if (ri > 0) { svgEl('line', { x1: 0, x2: W, y1: y + 0.5, y2: y + 0.5, 'class': 'mcc-grid' }, svg); y += rowGap; }
text(svg, lines, 0, y + lines.length * lh / 2, 'mcc-t-label', 'start', lh);
text(svg, change, W, y + lh / 2, 'mcc-t-change', 'end', lh);
y += lines.length * lh + 6;
var valW = Math.max(m(bt, 'mcc-t-value').w, m(at, 'mcc-t-value').w) + 10;
var span = W - tagW - valW;
var mx = Math.max(r.before, r.after);
[[o.beforeLabel, r.before, bt, 'mcc-f-3', 'mcc-t-value mcc-t-before'], [o.afterLabel, r.after, at, 'mcc-f-1', 'mcc-t-value']].forEach(function (b) {
var len = Math.max(2, b[1] / mx * span);
text(svg, b[0], 0, y + barH / 2, 'mcc-t-tick', 'start', lh);
svgEl('rect', { x: tagW, y: y, width: len, height: barH, 'class': b[3] }, svg);
text(svg, b[2], tagW + len + 6, y + barH / 2, b[4], 'start', lh);
y += barH + 4;
});
y += rowGap - 4;
});
finish(svg, W, y - rowGap + 6);
}
/* ---------- explainer steps, HTML so it reflows ---------- */
function steps(plot, o) {
clear(plot);
var ol = htmlEl('ol', 'mcc-steps', plot);
ol.style.setProperty('--mcc-step-count', o.steps.length);
var seen = false;
o.steps.forEach(function (s, i) {
var hl = s.highlight && !seen;
if (hl) seen = true;
var li = htmlEl('li', 'mcc-step' + (hl ? ' mcc-step--hl' : ''), ol);
htmlEl('span', 'mcc-step-num', li, String(i + 1));
var body = htmlEl('div', 'mcc-step-body', li);
htmlEl('p', 'mcc-step-title', body, s.title);
if (s.text) htmlEl('p', 'mcc-step-text', body, s.text);
if (s.figure) htmlEl('p', 'mcc-step-figure', body, s.figure);
});
}
/* ---------- mount ---------- */
var KINDS = { bar: bar, stacked: stacked, line: line, donut: donut, stat: stat, compare: compare, steps: steps };
var mounted = [];
function draw(rec) {
try { KINDS[rec.kind](rec.plot, rec.opts); }
catch (e) { refuse(rec.plot, 'The data for this chart could not be read. Check the JSON block. ' + e.message); }
}
function render(rec) {
var copy = JSON.parse(JSON.stringify(rec.data));
rec.opts = copy;
draw(rec);
}
function mount(scope) {
var figs = (scope || document).querySelectorAll('[data-mcc]');
Array.prototype.forEach.call(figs, function (fig) {
if (fig.__mcc) return;
var kind = fig.getAttribute('data-mcc');
var src = fig.querySelector('script[type="application/json"]');
var plot = fig.querySelector('.mcc-plot') || fig;
var rec = { kind: kind, plot: plot, fig: fig, data: null, w: 0 };
fig.__mcc = rec;
if (!KINDS[kind]) return refuse(plot, 'Unknown chart type ' + kind + '. Use bar, stacked, line, donut, stat, compare, or steps.');
try { rec.data = JSON.parse(src ? src.textContent : '{}'); }
catch (e) { return refuse(plot, 'The JSON block for this chart has a typo. ' + e.message); }
rec.w = plot.clientWidth;
render(rec);
mounted.push(rec);
if (root.ResizeObserver) {
new ResizeObserver(function () {
var w = plot.clientWidth;
if (Math.abs(w - rec.w) < 1) return;
rec.w = w;
render(rec);
}).observe(plot);
}
});
}
function redrawAll() { mounted.forEach(function (rec) { rec.w = rec.plot.clientWidth; render(rec); }); }
root.MCChart = { mount: mount, redraw: redrawAll, bar: bar, stacked: stacked, line: line, donut: donut, stat: stat, compare: compare, steps: steps, format: fmt };
root.addEventListener('beforeprint', redrawAll);
if (root.matchMedia) {
var mq = root.matchMedia('print');
if (mq.addEventListener) mq.addEventListener('change', redrawAll);
}
function start() {
var go = function () { mount(document); };
if (document.fonts && document.fonts.ready) document.fonts.ready.then(go); else go();
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
})(window);
report.css119 lines, 8.3 KB
/* Monthly report page styles. Phone first, Letter when printed or wider than 800px.
Every value is a token from tokens.css. The html element carries .mc-doc in Letter mode. */
@page { size: 8.5in 11in; margin: 0; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
font-family: var(--mc-font);
color: var(--mc-text-primary);
background: var(--mc-surface-page);
font-size: var(--mc-type-body-size);
line-height: var(--mc-type-body-leading);
-webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.num { font-variant-numeric: var(--mc-numeric-tabular); }
/* ---------- phone first ---------- */
.page { padding: var(--mc-space-07) var(--mc-screen-margin) var(--mc-space-08); }
.page + .page { padding-top: 0; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--mc-space-05); margin-bottom: var(--mc-space-08); }
.doc-head img { height: var(--mc-screen-header-logo-sm); width: auto; display: block; }
.doc-head .meta { text-align: right; color: var(--mc-text-tertiary); font-size: var(--mc-type-eyebrow-size); font-weight: var(--mc-weight-semibold); line-height: var(--mc-type-caption-leading); }
.page:not(:first-child) .doc-head { display: none; }
.foot { display: none; }
.eyebrow {
margin: 0 0 var(--mc-space-03); color: var(--mc-text-label);
font-size: var(--mc-type-eyebrow-size); font-weight: var(--mc-type-eyebrow-weight);
letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: var(--mc-type-eyebrow-case); line-height: var(--mc-type-eyebrow-leading);
}
h1 {
margin: 0 0 var(--mc-space-04); color: var(--mc-text-heading);
font-size: var(--mc-type-h1-size); font-weight: var(--mc-type-h1-weight);
line-height: var(--mc-type-h1-leading); letter-spacing: var(--mc-type-h1-tracking);
}
h2 {
margin: 0 0 var(--mc-space-05); color: var(--mc-text-heading);
font-size: var(--mc-type-h2-size); font-weight: var(--mc-type-h2-weight);
line-height: var(--mc-type-h2-leading); letter-spacing: var(--mc-type-h2-tracking);
}
h3 { margin: 0 0 var(--mc-space-03); color: var(--mc-text-heading); font-size: var(--mc-type-h3-size); font-weight: var(--mc-type-h3-weight); line-height: var(--mc-type-h3-leading); }
p { margin: 0 0 var(--mc-space-04); }
.lede { color: var(--mc-text-secondary); font-size: var(--mc-type-lede-size); font-weight: var(--mc-type-lede-weight); line-height: var(--mc-type-lede-leading); margin-bottom: var(--mc-space-08); }
.divider { width: var(--mc-border-width-divider-length); height: var(--mc-border-width-bar); background: var(--mc-border-accent); margin: 0 0 var(--mc-space-05); }
.section { margin-top: var(--mc-space-10); }
.copy { color: var(--mc-text-secondary); font-size: var(--mc-type-small-size); line-height: var(--mc-type-small-leading); }
.copy strong { color: var(--mc-text-primary); font-weight: var(--mc-weight-semibold); }
.g12 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mc-space-07); }
.g12 > * { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mc-space-07) var(--mc-space-05); }
/* Table, document spec: red header bar, white type, banded rows, 1px grey dividers, no vertical rules. */
.tablewrap { overflow-x: auto; margin-top: var(--mc-space-07); }
table { width: 100%; border-collapse: collapse; font-size: var(--mc-type-small-size); min-width: 520px; }
th { background: var(--mc-surface-table-header); color: var(--mc-text-on-accent); font-weight: var(--mc-weight-bold); text-align: left; padding: var(--mc-space-03) var(--mc-space-04); font-size: var(--mc-type-eyebrow-size); letter-spacing: 0.04em; }
td { padding: var(--mc-space-03) var(--mc-space-04); border-bottom: var(--mc-border-width-hairline) solid var(--mc-border-subtle); }
tbody tr:nth-child(even) td { background: var(--mc-surface-row-alt-print); }
th.num, td.num { text-align: right; font-variant-numeric: var(--mc-numeric-tabular); }
tfoot td { font-weight: var(--mc-weight-bold); color: var(--mc-text-heading); border-bottom: 0; border-top: var(--mc-border-width-strong) solid var(--mc-border-strong); }
/* Dark callout and editor note. */
.callout { background: var(--mc-surface-inverse); color: var(--mc-text-inverse); padding: var(--mc-space-07); margin-top: var(--mc-space-09); }
.callout .eyebrow { color: var(--mc-accent-on-inverse); }
.callout h3 { color: var(--mc-text-inverse); }
.callout ol { margin: 0; padding-left: var(--mc-space-06); color: var(--mc-text-inverse-secondary); font-size: var(--mc-type-small-size); line-height: var(--mc-type-small-leading); }
.callout li { margin-bottom: var(--mc-space-03); }
.callout li strong { color: var(--mc-text-inverse); font-weight: var(--mc-weight-semibold); }
.editor {
margin-top: var(--mc-space-08); padding: var(--mc-space-04) var(--mc-space-05);
background: var(--mc-surface-highlight); border-left: var(--mc-border-width-bar) solid var(--mc-border-accent);
font-size: var(--mc-type-small-size); line-height: var(--mc-type-small-leading); color: var(--mc-text-primary);
}
.editor b { color: var(--mc-text-label); font-weight: var(--mc-weight-bold); letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; font-size: var(--mc-type-eyebrow-size); display: block; margin-bottom: var(--mc-space-02); }
/* ---------- Letter. Same markup, document grid. ---------- */
.mc-doc body { background: var(--mc-surface-muted); }
.mc-doc .page {
width: var(--mc-doc-page-width); height: var(--mc-doc-page-height);
margin: 0 auto var(--mc-space-08); position: relative; overflow: hidden;
background: var(--mc-surface-page); box-shadow: var(--mc-shadow-2);
padding: var(--mc-doc-margin-top) var(--mc-doc-margin-side) var(--mc-doc-margin-bottom);
font-size: var(--mc-print-type-body-size);
break-after: page; page-break-after: always;
}
.mc-doc .page:last-child { break-after: auto; page-break-after: auto; }
.mc-doc .page:not(:first-child) .doc-head { display: flex; margin-bottom: var(--mc-space-07); }
.mc-doc .page:not(:first-child) .doc-head img { height: var(--mc-space-05); }
.mc-doc .doc-head { margin-bottom: var(--mc-space-08); }
.mc-doc .doc-head img { height: var(--mc-space-07); }
.mc-doc .doc-head .meta { font-size: var(--mc-print-type-caption-size); }
.mc-doc .foot {
display: flex; justify-content: space-between; align-items: baseline;
position: absolute; left: var(--mc-doc-margin-side); right: var(--mc-doc-margin-side); bottom: var(--mc-doc-footer-offset);
padding-top: var(--mc-space-03); border-top: var(--mc-border-width-hairline) solid var(--mc-border-subtle);
color: var(--mc-text-tertiary); font-size: var(--mc-print-type-caption-size); font-weight: var(--mc-weight-semibold);
}
.mc-doc .eyebrow { font-size: var(--mc-print-type-eyebrow-size); }
.mc-doc h1 { font-size: var(--mc-print-type-h1-size); max-width: 7in; }
.mc-doc h2 { font-size: var(--mc-print-type-h2-size); margin-bottom: var(--mc-space-05); }
.mc-doc h3 { font-size: var(--mc-print-type-h3-size); }
.mc-doc .lede { font-size: var(--mc-print-type-lede-size); max-width: 6.2in; margin-bottom: var(--mc-space-08); }
.mc-doc .copy, .mc-doc .callout ol, .mc-doc .editor { font-size: var(--mc-print-type-body-size); }
.mc-doc .section { margin-top: var(--mc-space-08); }
.mc-doc .section.first { margin-top: var(--mc-space-08); }
.mc-doc .g12 { grid-template-columns: repeat(var(--mc-doc-columns), minmax(0, 1fr)); column-gap: var(--mc-doc-gutter); row-gap: var(--mc-space-07); }
.mc-doc .c3 { grid-column: span 3; } .mc-doc .c4 { grid-column: span 4; } .mc-doc .c5 { grid-column: span 5; }
.mc-doc .c6 { grid-column: span 6; } .mc-doc .c7 { grid-column: span 7; } .mc-doc .c8 { grid-column: span 8; } .mc-doc .c12 { grid-column: span 12; }
.mc-doc .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--mc-doc-gutter); }
.mc-doc table { font-size: var(--mc-print-type-small-size); min-width: 0; }
.mc-doc th { font-size: var(--mc-print-type-eyebrow-size); }
.mc-doc .tablewrap { overflow: visible; margin-top: var(--mc-space-06); }
.mc-doc .callout { margin-top: var(--mc-space-08); padding: var(--mc-space-06) var(--mc-space-07); }
.mc-doc .editor { margin-top: var(--mc-space-06); }
@media print {
.mc-doc body { background: var(--mc-surface-page); }
.mc-doc .page { margin: 0; box-shadow: var(--mc-shadow-none); }
}
specimen.css103 lines, 9.6 KB
/* Palette and chart specimen page. Screen reference for the chart kit. Tokens only. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--mc-font); color: var(--mc-text-primary); background: var(--mc-surface-page); font-size: var(--mc-type-body-size); line-height: var(--mc-type-body-leading); }
.num { font-variant-numeric: var(--mc-numeric-tabular); }
.wrap { max-width: var(--mc-container); margin: 0 auto; padding: 0 var(--mc-screen-margin); }
@media (min-width: 768px) { .wrap { padding: 0 var(--mc-screen-margin-lg); } }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--mc-space-05); padding: var(--mc-space-09) 0 var(--mc-space-10); }
.top img { height: var(--mc-screen-header-logo); width: auto; display: block; }
.top .meta { text-align: right; color: var(--mc-text-tertiary); font-size: var(--mc-type-small-size); font-weight: var(--mc-weight-semibold); line-height: var(--mc-type-small-leading); }
.eyebrow { margin: 0 0 var(--mc-space-03); color: var(--mc-text-label); font-size: var(--mc-type-eyebrow-size); font-weight: var(--mc-type-eyebrow-weight); letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: var(--mc-type-eyebrow-case); line-height: var(--mc-type-eyebrow-leading); }
h1 { margin: 0 0 var(--mc-space-05); color: var(--mc-text-heading); font-size: var(--mc-type-cover-size); font-weight: var(--mc-weight-extrabold); line-height: var(--mc-type-h1-leading); letter-spacing: var(--mc-type-cover-tracking); max-width: 13em; }
h2 { margin: 0 0 var(--mc-space-04); color: var(--mc-text-heading); font-size: var(--mc-type-h2-size); font-weight: var(--mc-type-h2-weight); line-height: var(--mc-type-h2-leading); letter-spacing: var(--mc-type-h2-tracking); }
h3 { margin: 0 0 var(--mc-space-03); color: var(--mc-text-heading); font-size: var(--mc-type-h3-size); font-weight: var(--mc-type-h3-weight); line-height: var(--mc-type-h3-leading); }
p { margin: 0 0 var(--mc-space-04); }
.lede { color: var(--mc-text-secondary); font-size: var(--mc-type-lede-size); font-weight: var(--mc-type-lede-weight); line-height: var(--mc-type-lede-leading); max-width: 40em; }
.divider { width: var(--mc-border-width-divider-length); height: var(--mc-border-width-bar); background: var(--mc-border-accent); margin: 0 0 var(--mc-space-05); }
.small { font-size: var(--mc-type-small-size); line-height: var(--mc-type-small-leading); color: var(--mc-text-secondary); }
code { font-family: var(--mc-font); font-weight: var(--mc-weight-semibold); color: var(--mc-text-heading); font-size: 0.92em; }
.sec { padding: var(--mc-space-11) 0 0; }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mc-space-03) var(--mc-space-08); margin-bottom: var(--mc-space-08); }
@media (min-width: 900px) { .sec-head { grid-template-columns: 5fr 7fr; align-items: end; } .sec-head .small { margin: 0; } }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--mc-space-08) var(--mc-screen-gutter); }
.grid > * { min-width: 0; }
@media (min-width: 900px) {
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g75 { grid-template-columns: 7fr 5fr; }
.span2 { grid-column: span 2; }
}
/* Palette swatches, in order of use. */
.swatches { display: grid; grid-template-columns: minmax(0, 1fr); border-top: var(--mc-border-width-hairline) solid var(--mc-border-subtle); }
.sw { display: grid; grid-template-columns: var(--mc-space-11) minmax(0, 1fr) auto; gap: var(--mc-space-05); align-items: center; padding: var(--mc-space-04) 0; border-bottom: var(--mc-border-width-hairline) solid var(--mc-border-subtle); }
.chip { height: var(--mc-space-10); border-radius: var(--mc-radius-sm); position: relative; display: flex; align-items: flex-end; padding: var(--mc-space-02) var(--mc-space-03); font-weight: var(--mc-weight-extrabold); font-size: var(--mc-type-small-size); }
.chip.on-dark { color: var(--mc-text-inverse); }
.chip.on-light { color: var(--mc-text-heading); }
.sw-name { font-weight: var(--mc-weight-bold); color: var(--mc-text-heading); font-size: var(--mc-type-small-size); }
.sw-role { color: var(--mc-text-secondary); font-size: var(--mc-type-small-size); line-height: var(--mc-type-small-leading); }
.sw-meta { color: var(--mc-text-tertiary); font-size: var(--mc-type-caption-size); font-weight: var(--mc-weight-semibold); }
.sw-check { text-align: right; font-size: var(--mc-type-caption-size); font-weight: var(--mc-weight-semibold); color: var(--mc-text-secondary); white-space: nowrap; font-variant-numeric: var(--mc-numeric-tabular); }
.sw-check b { display: block; color: var(--mc-text-heading); font-size: var(--mc-type-h3-size); font-weight: var(--mc-weight-extrabold); }
.f-1 { background: var(--mc-data-1); } .f-2 { background: var(--mc-data-2); } .f-3 { background: var(--mc-data-3); }
.f-4 { background: var(--mc-data-4); } .f-hl { background: var(--mc-data-highlight); }
.f-grid { background: var(--mc-surface-page); box-shadow: inset 0 calc(var(--mc-border-width-hairline) * -1) 0 var(--mc-data-gridline), inset 0 0 0 var(--mc-border-width-hairline) var(--mc-border-subtle); }
.f-axis { background: var(--mc-data-axis); }
/* Order of use strips. */
.order { display: grid; gap: var(--mc-space-04); }
.order-row { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: var(--mc-space-04); align-items: center; }
.order-row span { font-size: var(--mc-type-small-size); font-weight: var(--mc-weight-semibold); color: var(--mc-text-primary); }
.strip { display: flex; gap: var(--mc-border-width-strong); height: var(--mc-space-07); }
.strip i { flex: 1; display: block; }
.strip i.sm { flex: 0.35; }
/* Navy panel. */
.panel-inv { background: var(--mc-surface-inverse); color: var(--mc-text-inverse); padding: var(--mc-space-07); }
.panel-inv h3 { color: var(--mc-text-inverse); }
.panel-inv .small { color: var(--mc-text-inverse-secondary); }
.panel-inv .eyebrow { color: var(--mc-accent-on-inverse); }
/* Tables, document spec. */
.tablewrap { overflow-x: auto; max-width: 100%; }
@media (max-width: 599px) { #pairs th:nth-child(2), #pairs td:nth-child(2) { display: none; } #pairs td, #pairs th { padding-left: var(--mc-space-02); padding-right: var(--mc-space-02); } }
table { width: 100%; border-collapse: collapse; font-size: var(--mc-type-small-size); }
th { background: var(--mc-surface-table-header); color: var(--mc-text-on-accent); font-weight: var(--mc-weight-bold); text-align: left; padding: var(--mc-space-03) var(--mc-space-04); font-size: var(--mc-type-eyebrow-size); letter-spacing: 0.04em; }
td { padding: var(--mc-space-03) var(--mc-space-04); border-bottom: var(--mc-border-width-hairline) solid var(--mc-border-subtle); vertical-align: middle; }
tbody tr:nth-child(even) td { background: var(--mc-surface-row-alt-print); }
th.num, td.num { text-align: right; font-variant-numeric: var(--mc-numeric-tabular); }
.pair { display: inline-flex; gap: var(--mc-space-01); vertical-align: middle; margin-right: var(--mc-space-03); }
.pair i { width: var(--mc-space-06); height: var(--mc-space-06); display: block; border-radius: var(--mc-radius-sm); box-shadow: inset 0 0 0 var(--mc-border-width-hairline) var(--mc-border-subtle); }
.res { font-weight: var(--mc-weight-bold); }
.res.pass { color: var(--mc-status-success); }
.res.label { color: var(--mc-text-heading); }
.res.never { color: var(--mc-status-error); }
.on-navy { background: var(--mc-surface-inverse); }
.inv-1 { background: var(--mc-text-inverse); } .inv-2 { background: var(--mc-text-inverse-tertiary); } .inv-3 { background: var(--mc-border-inverse); } .inv-hl { background: var(--mc-accent-on-inverse); }
.pair.navy { background: var(--mc-surface-inverse); padding: var(--mc-space-01); border-radius: var(--mc-radius-sm); }
/* Specimen cards. */
.card { border-top: var(--mc-border-width-strong) solid var(--mc-text-heading); padding-top: var(--mc-space-05); }
.card-kind { display: flex; justify-content: space-between; gap: var(--mc-space-04); margin-bottom: var(--mc-space-05); font-size: var(--mc-type-caption-size); font-weight: var(--mc-weight-semibold); color: var(--mc-text-tertiary); }
.card-kind > span:last-child:not(:first-child) { white-space: nowrap; }
.card-kind b { color: var(--mc-text-heading); font-weight: var(--mc-weight-bold); }
.stats4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mc-space-07) var(--mc-space-05); }
@media (min-width: 900px) { .stats4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Rules. */
.rules { counter-reset: r; display: grid; gap: var(--mc-space-06) var(--mc-screen-gutter); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .rules { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rule { border-top: var(--mc-border-width-hairline) solid var(--mc-border-strong); padding-top: var(--mc-space-04); }
.rule h3 { font-size: var(--mc-type-small-size); }
.rule h3::before { counter-increment: r; content: counter(r) ". "; color: var(--mc-text-label); }
.rule p { font-size: var(--mc-type-small-size); line-height: var(--mc-type-small-leading); color: var(--mc-text-secondary); margin: 0; }
.foot { margin-top: var(--mc-space-12); padding: var(--mc-space-05) 0 var(--mc-space-09); border-top: var(--mc-border-width-hairline) solid var(--mc-border-subtle); display: flex; justify-content: space-between; gap: var(--mc-space-05); color: var(--mc-text-tertiary); font-size: var(--mc-type-caption-size); font-weight: var(--mc-weight-semibold); }
report.html242 lines, 12.4 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>September 2026 lead report, roofing client</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="charts.css">
<link rel="stylesheet" href="report.css">
<link rel="icon" type="image/svg+xml" href="../../../tokens/v/best/logos/marathon-mark-lines.svg">
<script>
/* Letter layout when printing or wider than 800px, phone layout below that. */
(function () {
var h = document.documentElement;
var q = window.matchMedia('print, (min-width: 800px)');
function set() { h.classList.toggle('mc-doc', q.matches); }
set();
window.addEventListener('resize', set);
window.addEventListener('beforeprint', function () { h.classList.add('mc-doc'); });
window.addEventListener('afterprint', set);
})();
</script>
<script src="charts.js" defer></script>
</head>
<body>
<!-- Page 1 -->
<section class="page">
<header class="doc-head">
<img src="../../../tokens/v/best/logos/marathon-logo-dark.svg" alt="Marathon Creative">
<div class="meta">Monthly performance report<br>Prepared October 3, 2026</div>
</header>
<p class="eyebrow">Lead report, September 2026</p>
<h1>212 leads in September, our cheapest month yet</h1>
<p class="lede">Paid search did most of the work, and PaceCRM answered every form in under a minute. Where the leads came from, what they cost, and what we change in October.</p>
<div class="stats">
<div class="mcc" data-mcc="stat"><script type="application/json">
{"value": 212, "label": "Leads in September", "delta": {"text": "Up 12% on August"}, "spark": [110, 133, 155, 172, 189, 212]}
</script></div>
<div class="mcc" data-mcc="stat"><script type="application/json">
{"value": 68, "format": {"type": "money"}, "label": "Paid search cost per lead", "delta": {"text": "Down 54% since October 2025"}, "highlight": true}
</script></div>
<div class="mcc" data-mcc="stat"><script type="application/json">
{"value": "58", "unit": "sec", "label": "Median first reply, by PaceCRM text", "delta": {"text": "Was 4 hr 12 min"}}
</script></div>
<div class="mcc" data-mcc="stat"><script type="application/json">
{"value": 31, "label": "Signed roof replacements", "delta": {"text": "From 96 inspections"}}
</script></div>
</div>
<div class="section first">
<div class="divider"></div>
<p class="eyebrow">01 Lead sources</p>
<h2>Local Services Ads brought in 74 of 212 leads</h2>
<div class="g12">
<figure class="mcc c8" data-mcc="bar">
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Leads by first touch. Source: PaceCRM, September 1 to 30, 2026.</figcaption>
<script type="application/json">
{"label": "Leads by channel, September 2026", "share": true, "data": [
{"label": "Google Local Services Ads", "value": 74, "highlight": true},
{"label": "Google Search Ads", "value": 52},
{"label": "Meta Ads", "value": 41},
{"label": "Organic search and Google Business Profile", "value": 28},
{"label": "Referral and repeat customers", "value": 17}
]}
</script>
</figure>
<div class="c4 copy">
<p><strong>Why it matters.</strong> Local Services Ads charge per lead, not per click, and the Google Guaranteed badge does the trust work a roofer usually has to do on the phone.</p>
<p><strong>What we watch.</strong> Meta leads are cheaper at $54 but book inspections at half the rate. We keep the budget there for storm weeks only.</p>
</div>
</div>
</div>
<div class="editor"><b>Editor note, internal</b>Example figures shaped from a Houston roofing account. Replace them with the client's PaceCRM export and have Jacob confirm before this goes out.</div>
<footer class="foot"><span>September 2026 lead report, roofing client</span><span class="num">Page 1 of 4</span></footer>
</section>
<!-- Page 2 -->
<section class="page">
<header class="doc-head">
<img src="../../../tokens/v/best/logos/marathon-logo-dark.svg" alt="Marathon Creative">
<div class="meta">September 2026 lead report</div>
</header>
<div class="section first">
<div class="divider"></div>
<p class="eyebrow">02 Six-month trend</p>
<h2>Leads nearly doubled since April</h2>
<figure class="mcc" data-mcc="stacked">
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Leads per month by channel group. Paid search is Local Services Ads plus Search Ads. Source: PaceCRM.</figcaption>
<script type="application/json">
{"label": "Leads per month by channel, April to September 2026", "focus": "last",
"categories": ["Apr", "May", "Jun", "Jul", "Aug", "Sep"],
"series": [
{"name": "Paid search", "values": [58, 71, 84, 96, 108, 126]},
{"name": "Meta Ads", "values": [22, 28, 33, 36, 38, 41]},
{"name": "Organic", "values": [18, 21, 24, 25, 27, 28]},
{"name": "Referral", "values": [12, 13, 14, 15, 16, 17]}
]}
</script>
</figure>
</div>
<div class="section">
<div class="divider"></div>
<p class="eyebrow">03 Cost per lead</p>
<h2>Paid search cost per lead fell from $148 to $68</h2>
<figure class="mcc" data-mcc="line">
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Monthly ad spend divided by new leads, October 2025 to September 2026. Source: Google Ads, Meta Ads Manager, and PaceCRM.</figcaption>
<script type="application/json">
{"label": "Cost per lead by month", "format": {"type": "money"},
"categories": ["Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"],
"series": [
{"name": "Paid search", "values": [148, 151, 146, 139, 118, 104, 95, 88, 81, 76, 71, 68], "highlight": true},
{"name": "Meta Ads", "values": [92, 95, 94, 90, 79, 72, 68, 64, 61, 58, 56, 54]}
],
"annotations": [{"series": 0, "index": 3, "text": "Marathon takes over the account"}]}
</script>
</figure>
<div class="g12" style="margin-top: var(--mc-space-06);">
<p class="copy c6"><strong>What changed in January.</strong> We cut 41 broad keywords, moved budget into Local Services Ads, and connected every form to PaceCRM so no lead waits for someone to check an inbox.</p>
<p class="copy c6"><strong>Where it levels off.</strong> Houston roofing search runs about $60 to $70 a lead in a normal month. Below that we expect gains from booking rate, not from cheaper clicks.</p>
</div>
</div>
<footer class="foot"><span>September 2026 lead report, roofing client</span><span class="num">Page 2 of 4</span></footer>
</section>
<!-- Page 3 -->
<section class="page">
<header class="doc-head">
<img src="../../../tokens/v/best/logos/marathon-logo-dark.svg" alt="Marathon Creative">
<div class="meta">September 2026 lead report</div>
</header>
<div class="g12 section first">
<div class="c6">
<div class="divider"></div>
<p class="eyebrow">04 Lead outcomes</p>
<h2>45% of leads booked an inspection</h2>
<figure class="mcc" data-mcc="donut">
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Status on September 30. Source: PaceCRM pipeline.</figcaption>
<script type="application/json">
{"label": "Where September leads went", "center": {"value": "212", "label": "leads"},
"data": [
{"label": "Inspection booked", "value": 96, "highlight": true},
{"label": "Still in follow-up", "value": 71},
{"label": "Not a fit", "value": 45}
]}
</script>
</figure>
</div>
<div class="c6">
<div class="divider"></div>
<p class="eyebrow">05 Before and after</p>
<h2>Faster replies, cheaper leads, more inspections</h2>
<figure class="mcc" data-mcc="compare">
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Q4 2025 average against September 2026.</figcaption>
<script type="application/json">
{"label": "Before and after Marathon", "beforeLabel": "Q4 2025", "afterLabel": "Sep 2026",
"rows": [
{"label": "Paid search cost per lead", "before": 148, "after": 68, "format": {"type": "money"}},
{"label": "Median first reply", "before": 252, "after": 0.97, "beforeText": "4 hr 12 min", "afterText": "58 sec", "changeText": "260 times faster"},
{"label": "Leads that book an inspection", "before": 28, "after": 45, "format": {"type": "percent"}, "changeText": "17 points higher"}
]}
</script>
</figure>
</div>
</div>
<div class="section">
<div class="divider"></div>
<p class="eyebrow">Channel detail</p>
<h3>Every number above, by channel</h3>
<div class="tablewrap">
<table>
<thead><tr><th>Channel</th><th class="num">Leads</th><th class="num">Ad spend</th><th class="num">Cost per lead</th><th class="num">Inspections</th><th class="num">Signed</th></tr></thead>
<tbody>
<tr><td>Google Local Services Ads</td><td class="num">74</td><td class="num">$4,514</td><td class="num">$61</td><td class="num">38</td><td class="num">13</td></tr>
<tr><td>Google Search Ads</td><td class="num">52</td><td class="num">$4,004</td><td class="num">$77</td><td class="num">24</td><td class="num">7</td></tr>
<tr><td>Meta Ads</td><td class="num">41</td><td class="num">$2,214</td><td class="num">$54</td><td class="num">14</td><td class="num">3</td></tr>
<tr><td>Organic search and Google Business Profile</td><td class="num">28</td><td class="num">$0</td><td class="num">n/a</td><td class="num">12</td><td class="num">4</td></tr>
<tr><td>Referral and repeat customers</td><td class="num">17</td><td class="num">$0</td><td class="num">n/a</td><td class="num">8</td><td class="num">4</td></tr>
</tbody>
<tfoot><tr><td>Total</td><td class="num">212</td><td class="num">$10,732</td><td class="num">$51</td><td class="num">96</td><td class="num">31</td></tr></tfoot>
</table>
</div>
</div>
<footer class="foot"><span>September 2026 lead report, roofing client</span><span class="num">Page 3 of 4</span></footer>
</section>
<!-- Page 4 -->
<section class="page">
<header class="doc-head">
<img src="../../../tokens/v/best/logos/marathon-logo-dark.svg" alt="Marathon Creative">
<div class="meta">September 2026 lead report</div>
</header>
<div class="section first">
<div class="divider"></div>
<p class="eyebrow">06 How a lead is handled</p>
<h2>The first minute after a homeowner fills out a form</h2>
<figure class="mcc" data-mcc="steps">
<div class="mcc-plot"></div>
<script type="application/json">
{"steps": [
{"title": "Homeowner submits a form", "text": "From Local Services Ads, Meta, or the website.", "figure": "0 sec"},
{"title": "PaceCRM creates the contact", "text": "Tags the source, the ZIP code, and the storm date.", "figure": "2 sec"},
{"title": "A text goes out", "text": "From the office number, in the roofer's own words.", "figure": "58 sec median", "highlight": true},
{"title": "The office gets a call task", "text": "Push alert to the sales rep with the lead's details.", "figure": "Same minute"},
{"title": "Inspection lands on the calendar", "text": "Homeowner picks a slot from the text link.", "figure": "45% of leads"}
]}
</script>
</figure>
</div>
<div class="callout">
<p class="eyebrow">What we change in October</p>
<h3>Three moves, all live by October 10</h3>
<ol>
<li><strong>Move $1,500 from Meta to Local Services Ads.</strong> Meta stays on for storm weeks only.</li>
<li><strong>Add a second text at 24 hours</strong> for the 71 leads still in follow-up. We write it, you approve it.</li>
<li><strong>Shoot drone photos of 10 recent roofs</strong> for the Google Business Profile. Our crew, two shoot days.</li>
</ol>
</div>
<footer class="foot"><span>September 2026 lead report, roofing client</span><span class="num">Page 4 of 4</span></footer>
</section>
</body>
</html>
specimen.html368 lines, 26.0 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Chart palette and specimen, Marathon Creative</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="charts.css">
<link rel="stylesheet" href="specimen.css">
<link rel="icon" type="image/svg+xml" href="../../../tokens/v/best/logos/marathon-mark-lines.svg">
<script src="charts.js" defer></script>
</head>
<body>
<div class="wrap">
<header class="top">
<img src="../../../tokens/v/best/logos/marathon-logo-dark.svg" alt="Marathon Creative">
<div class="meta">Design system, Tier 2<br>Informative and data graphics, v1.0</div>
</header>
<p class="eyebrow">Charts and diagrams</p>
<h1>One finding per chart, labelled where the eye already is</h1>
<p class="lede">Navy carries the measure, greys carry the context, and Marathon Red marks the one thing the chart is about. Every colour on this page is read from tokens.css, and every contrast figure below is measured live from those tokens.</p>
<!-- 1. Palette -->
<section class="sec">
<div class="sec-head">
<div><div class="divider"></div><p class="eyebrow">01 Chart palette</p><h2>Five colours, used in this order</h2></div>
<p class="small">Reach for series 1 first and add the next colour only when a second series is unavoidable. Red is never a series. It is the highlight, and a chart gets one. On navy, the palette flips to white tints and Red Bright, which is the only place Red Bright is allowed.</p>
</div>
<div class="grid g75">
<div class="swatches" id="swatches">
<div class="sw" data-token="--mc-data-1">
<div class="chip f-1 on-dark">1</div>
<div><div class="sw-name">--mc-data-1, Marathon Navy</div><div class="sw-role">The measure. Every single-series chart is this colour. Pantone 5395 C.</div></div>
<div class="sw-check"><b class="cr">0</b>on white<br><span class="ls"></span></div>
</div>
<div class="sw" data-token="--mc-data-2">
<div class="chip f-2 on-dark">2</div>
<div><div class="sw-name">--mc-data-2, Slate 500</div><div class="sw-role">Comparison or prior period. The second line, the second stack segment. Single K on press.</div></div>
<div class="sw-check"><b class="cr">0</b>on white<br><span class="ls"></span></div>
</div>
<div class="sw" data-token="--mc-data-3">
<div class="chip f-3 on-light">3</div>
<div><div class="sw-name">--mc-data-3, Gray 300</div><div class="sw-role">Context, benchmark, before. Too light to stand alone, so it always carries a direct label in Slate 700.</div></div>
<div class="sw-check"><b class="cr">0</b>on white<br><span class="ls"></span></div>
</div>
<div class="sw" data-token="--mc-data-4">
<div class="chip f-4 on-dark">4</div>
<div><div class="sw-name">--mc-data-4, Navy Soft</div><div class="sw-role">Only when four series are unavoidable. Sits next to Gray 300, never next to series 1.</div></div>
<div class="sw-check"><b class="cr">0</b>on white<br><span class="ls"></span></div>
</div>
<div class="sw" data-token="--mc-data-highlight">
<div class="chip f-hl on-dark">H</div>
<div><div class="sw-name">--mc-data-highlight, Marathon Red</div><div class="sw-role">The one bar, slice, point, or line the title talks about. One per chart. Pantone 7621 C.</div></div>
<div class="sw-check"><b class="cr">0</b>on white<br><span class="ls"></span></div>
</div>
<div class="sw" data-token="--mc-data-axis">
<div class="chip f-axis on-dark">A</div>
<div><div class="sw-name">--mc-data-axis and --mc-data-gridline</div><div class="sw-role">Tick text and the zero line in Slate 500. Gridlines in Gray 200, horizontal only, 1px.</div></div>
<div class="sw-check"><b class="cr">0</b>on white<br><span class="ls"></span></div>
</div>
</div>
<div>
<h3>Order of use</h3>
<p class="small">Read across. Each row is the full palette for a chart with that many series.</p>
<div class="order">
<div class="order-row"><span>One series</span><div class="strip"><i class="f-1"></i></div></div>
<div class="order-row"><span>One series, one finding</span><div class="strip"><i class="f-1"></i><i class="f-1"></i><i class="f-hl sm"></i><i class="f-1"></i></div></div>
<div class="order-row"><span>Two series</span><div class="strip"><i class="f-1"></i><i class="f-2"></i></div></div>
<div class="order-row"><span>Three series</span><div class="strip"><i class="f-1"></i><i class="f-2"></i><i class="f-3"></i></div></div>
<div class="order-row"><span>Four series</span><div class="strip"><i class="f-1"></i><i class="f-2"></i><i class="f-3"></i><i class="f-4"></i></div></div>
<div class="order-row"><span>Before and after</span><div class="strip"><i class="f-3"></i><i class="f-1"></i></div></div>
</div>
<figure class="mcc mcc--inverse panel-inv" data-mcc="bar" style="margin-top: var(--mc-space-08);">
<p class="mcc-eyebrow">On navy</p>
<h3 class="mcc-title">Local Services Ads booked 38 of 96 inspections</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">White for the measure, Red Bright for the finding. Source: PaceCRM, September 2026.</figcaption>
<script type="application/json">
{"label": "Inspections booked by channel", "data": [
{"label": "Local Services Ads", "value": 38, "highlight": true},
{"label": "Search Ads", "value": 24},
{"label": "Meta Ads", "value": 14},
{"label": "Organic", "value": 12},
{"label": "Referral", "value": 8}
]}
</script>
</figure>
</div>
</div>
</section>
<!-- 2. Contrast checks -->
<section class="sec">
<div class="sec-head">
<div><div class="divider"></div><p class="eyebrow">02 Contrast checks</p><h2>Measured from the tokens, not typed in</h2></div>
<p class="small">Ratios are WCAG relative-luminance contrast, computed in the browser from tokens.css each time this page loads. A chart mark needs 3:1 against its background to stand alone. Neighbouring segments need 2:1 plus the 2px gap the kit draws between them. Grey L* is the lightness a mono laser printer or a photocopy keeps.</p>
</div>
<div class="tablewrap"><table id="pairs">
<thead><tr><th>Pair</th><th>Where it happens</th><th class="num">Contrast</th><th class="num">Grey L* gap</th><th>Result</th></tr></thead>
<tbody>
<tr data-a="--mc-data-1" data-b="--mc-surface-page" data-min="3" data-ok="Pass. Fill, line, or type." data-no="Fails"><td><span class="pair"><i class="f-1"></i><i class="f-grid"></i></span>Series 1 on white</td><td>Every bar, line, and column</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-2" data-b="--mc-surface-page" data-min="3" data-ok="Pass. Fill, line, or type." data-no="Fails"><td><span class="pair"><i class="f-2"></i><i class="f-grid"></i></span>Series 2 on white</td><td>Second line, prior period</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-3" data-b="--mc-surface-page" data-min="3" data-ok="Pass" data-no="Context only. Direct label required." data-nocls="label"><td><span class="pair"><i class="f-3"></i><i class="f-grid"></i></span>Series 3 on white</td><td>Benchmarks, before bars</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-4" data-b="--mc-surface-page" data-min="3" data-ok="Pass. Fill or line." data-no="Fails"><td><span class="pair"><i class="f-4"></i><i class="f-grid"></i></span>Series 4 on white</td><td>Fourth stack segment</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-highlight" data-b="--mc-surface-page" data-min="4.5" data-ok="Pass. Fill, line, or type." data-no="Fails"><td><span class="pair"><i class="f-hl"></i><i class="f-grid"></i></span>Highlight on white</td><td>The finding</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-1" data-b="--mc-data-2" data-min="2" data-ok="Pass with the 2px gap" data-no="Keep apart"><td><span class="pair"><i class="f-1"></i><i class="f-2"></i></span>Series 1 next to 2</td><td>Stack segments, crossing lines</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-2" data-b="--mc-data-3" data-min="2" data-ok="Pass with the 2px gap" data-no="Keep apart"><td><span class="pair"><i class="f-2"></i><i class="f-3"></i></span>Series 2 next to 3</td><td>Stack segments</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-3" data-b="--mc-data-4" data-min="2" data-ok="Pass with the 2px gap" data-no="Keep apart"><td><span class="pair"><i class="f-3"></i><i class="f-4"></i></span>Series 3 next to 4</td><td>Stack segments</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-highlight" data-b="--mc-data-1" data-min="1.8" data-ok="Pass. Hue carries it, the gap separates it." data-no="Keep apart"><td><span class="pair"><i class="f-hl"></i><i class="f-1"></i></span>Highlight next to series 1</td><td>Red bar in a navy set</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-data-1" data-b="--mc-data-4" data-min="2" data-ok="Pass" data-no="Never adjacent" data-nocls="never"><td><span class="pair"><i class="f-1"></i><i class="f-4"></i></span>Series 1 next to 4</td><td>Not allowed, the kit stacks 1, 2, 3, 4</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-text-inverse" data-b="--mc-surface-inverse" data-min="3" data-ok="Pass. Fill, line, or type." data-no="Fails"><td><span class="pair navy"><i class="inv-1"></i></span>White on navy</td><td>Inverse series 1</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-text-inverse-tertiary" data-b="--mc-surface-inverse" data-min="3" data-ok="Pass. Fill or line." data-no="Fails"><td><span class="pair navy"><i class="inv-2"></i></span>White 60% on navy</td><td>Inverse series 2</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
<tr data-a="--mc-accent-on-inverse" data-b="--mc-surface-inverse" data-min="3" data-ok="Pass" data-no="Fill only. White value label beside it." data-nocls="label"><td><span class="pair navy"><i class="inv-hl"></i></span>Red Bright on navy</td><td>Inverse highlight</td><td class="num cr"></td><td class="num dl"></td><td class="res"></td></tr>
</tbody>
</table></div>
</section>
<!-- 3. Specimens -->
<section class="sec">
<div class="sec-head">
<div><div class="divider"></div><p class="eyebrow">03 The kit</p><h2>Seven chart types, one example client</h2></div>
<p class="small">Example data shaped from a Houston roofing account on Local Services Ads, Search Ads, Meta Ads, and PaceCRM, September 2026. Figures are flagged for Jacob to confirm before any of them appear in client work. Each chart is a figure with a JSON block, so the copy a team member edits is plain text.</p>
</div>
<div class="stats4">
<div class="mcc" data-mcc="stat"><script type="application/json">{"value": 212, "label": "Leads in September", "delta": {"text": "Up 12% on August"}, "spark": [110, 133, 155, 172, 189, 212]}</script></div>
<div class="mcc" data-mcc="stat"><script type="application/json">{"value": 68, "format": {"type": "money"}, "label": "Paid search cost per lead", "delta": {"text": "Down 54% since October 2025"}, "highlight": true}</script></div>
<div class="mcc" data-mcc="stat"><script type="application/json">{"value": "58", "unit": "sec", "label": "Median first reply, by PaceCRM text", "delta": {"text": "Was 4 hr 12 min"}}</script></div>
<div class="mcc" data-mcc="stat"><script type="application/json">{"value": 31, "label": "Signed roof replacements", "delta": {"text": "From 96 inspections"}}</script></div>
</div>
<p class="card-kind" style="margin-top: var(--mc-space-04);"><span><b>Stat tile.</b> Big number, plain label, one delta. Sparkline optional, last point in red.</span></p>
<div class="grid g2" style="margin-top: var(--mc-space-09);">
<div class="card">
<div class="card-kind"><span><b>Bar.</b> Ranking categories. Sorted, labelled at the bar end, no axis.</span><span>data-mcc="bar"</span></div>
<figure class="mcc" data-mcc="bar">
<p class="mcc-eyebrow">Lead sources</p>
<h3 class="mcc-title">Local Services Ads brought in 74 of 212 leads</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Leads by first touch. Source: PaceCRM, September 1 to 30, 2026.</figcaption>
<script type="application/json">
{"label": "Leads by channel", "share": true, "data": [
{"label": "Google Local Services Ads", "value": 74, "highlight": true},
{"label": "Google Search Ads", "value": 52},
{"label": "Meta Ads", "value": 41},
{"label": "Organic search", "value": 28},
{"label": "Referral and repeat", "value": 17}
]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Line.</b> Change over time. Names sit at the line ends.</span><span>data-mcc="line"</span></div>
<figure class="mcc" data-mcc="line">
<p class="mcc-eyebrow">Cost per lead</p>
<h3 class="mcc-title">Paid search cost per lead fell from $148 to $68</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Ad spend divided by new leads. Source: Google Ads, Meta Ads Manager, PaceCRM.</figcaption>
<script type="application/json">
{"label": "Cost per lead by month", "format": {"type": "money"},
"categories": ["Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep"],
"series": [
{"name": "Paid search", "values": [148, 151, 146, 139, 118, 104, 95, 88, 81, 76, 71, 68], "highlight": true},
{"name": "Meta Ads", "values": [92, 95, 94, 90, 79, 72, 68, 64, 61, 58, 56, 54]}
],
"annotations": [{"series": 0, "index": 3, "text": "Marathon takes over"}]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Stacked column.</b> Parts of a total over time. Four series at most.</span><span>data-mcc="stacked"</span></div>
<figure class="mcc" data-mcc="stacked">
<p class="mcc-eyebrow">Six-month trend</p>
<h3 class="mcc-title">Leads nearly doubled since April</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Leads per month by channel group. Source: PaceCRM.</figcaption>
<script type="application/json">
{"label": "Leads per month by channel", "focus": "last",
"categories": ["Apr", "May", "Jun", "Jul", "Aug", "Sep"],
"series": [
{"name": "Paid search", "values": [58, 71, 84, 96, 108, 126]},
{"name": "Meta Ads", "values": [22, 28, 33, 36, 38, 41]},
{"name": "Organic", "values": [18, 21, 24, 25, 27, 28]},
{"name": "Referral", "values": [12, 13, 14, 15, 16, 17]}
]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Donut.</b> Sparingly. Parts of one whole, four parts at most.</span><span>data-mcc="donut"</span></div>
<figure class="mcc" data-mcc="donut">
<p class="mcc-eyebrow">Lead outcomes</p>
<h3 class="mcc-title">45% of leads booked an inspection</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Status on September 30. Source: PaceCRM pipeline.</figcaption>
<script type="application/json">
{"label": "Where September leads went", "center": {"value": "212", "label": "leads"},
"data": [
{"label": "Inspection booked", "value": 96, "highlight": true},
{"label": "Still in follow-up", "value": 71},
{"label": "Not a fit", "value": 45}
]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Comparison.</b> Before and after, one row per metric.</span><span>data-mcc="compare"</span></div>
<figure class="mcc" data-mcc="compare">
<p class="mcc-eyebrow">Before and after</p>
<h3 class="mcc-title">Faster replies, cheaper leads, more inspections</h3>
<div class="mcc-plot"></div>
<figcaption class="mcc-source">Q4 2025 average against September 2026.</figcaption>
<script type="application/json">
{"label": "Before and after Marathon", "beforeLabel": "Q4 2025", "afterLabel": "Sep 2026",
"rows": [
{"label": "Paid search cost per lead", "before": 148, "after": 68, "format": {"type": "money"}},
{"label": "Median first reply", "before": 252, "after": 0.97, "beforeText": "4 hr 12 min", "afterText": "58 sec", "changeText": "260 times faster"},
{"label": "Leads that book an inspection", "before": 28, "after": 45, "format": {"type": "percent"}, "changeText": "17 points higher"}
]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Explainer.</b> A process in numbered steps. One step in red.</span><span>data-mcc="steps"</span></div>
<figure class="mcc" data-mcc="steps">
<p class="mcc-eyebrow">How a lead is handled</p>
<h3 class="mcc-title">The first minute after a homeowner fills out a form</h3>
<div class="mcc-plot"></div>
<script type="application/json">
{"steps": [
{"title": "Form submitted", "text": "Local Services Ads, Meta, or the website.", "figure": "0 sec"},
{"title": "PaceCRM files it", "text": "Source, ZIP code, and storm date tagged.", "figure": "2 sec"},
{"title": "Text goes out", "text": "From the office number, in the roofer's words.", "figure": "58 sec median", "highlight": true},
{"title": "Inspection booked", "text": "Homeowner picks a slot from the link.", "figure": "45% of leads"}
]}
</script>
</figure>
</div>
</div>
</section>
<!-- 4. Guardrails -->
<section class="sec">
<div class="sec-head">
<div><div class="divider"></div><p class="eyebrow">04 Guardrails</p><h2>What the kit does when the input is wrong</h2></div>
<p class="small">These three are live. Each one was fed the kind of data a busy person actually pastes in. The kit makes the wrong chart hard to produce, rather than trusting nobody tries.</p>
</div>
<div class="grid g3">
<div class="card">
<div class="card-kind"><span><b>Seven slices into a donut</b></span></div>
<figure class="mcc" data-mcc="donut">
<h3 class="mcc-title">Photography is a third of September production hours</h3>
<div class="mcc-plot"></div>
<script type="application/json">
{"label": "Production hours by service", "data": [
{"label": "Listing photography", "value": 118, "highlight": true},
{"label": "Videography and DaVinci edit", "value": 64},
{"label": "Drone and aerial", "value": 41},
{"label": "3D tours and floorplans", "value": 37},
{"label": "Headshots", "value": 22},
{"label": "Social content", "value": 48},
{"label": "Print and signage", "value": 19}
]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Overlong labels, two highlights</b></span></div>
<figure class="mcc" data-mcc="bar">
<h3 class="mcc-title">Storm-week Local Services Ads leads cost less than any other channel we ran for this roofer in September, including Search Ads</h3>
<div class="mcc-plot"></div>
<script type="application/json">
{"label": "Cost per lead by channel", "format": {"type": "money"}, "data": [
{"label": "Google Local Services Ads during the two storm weeks after the September 9 hail", "value": 49, "highlight": true},
{"label": "Google Search Ads, roof replacement and roof repair keyword groups", "value": 77, "highlight": true},
{"label": "Meta Ads lead forms, homeowners within 15 miles of the shop", "value": 54}
]}
</script>
</figure>
</div>
<div class="card">
<div class="card-kind"><span><b>Six lines on one chart</b></span></div>
<figure class="mcc" data-mcc="line">
<h3 class="mcc-title">Cost per lead by channel</h3>
<div class="mcc-plot"></div>
<script type="application/json">
{"categories": ["Jul", "Aug", "Sep"], "series": [
{"name": "LSA", "values": [66, 63, 61]}, {"name": "Search", "values": [86, 81, 77]},
{"name": "Meta", "values": [58, 56, 54]}, {"name": "Nextdoor", "values": [91, 88, 84]},
{"name": "Yelp", "values": [120, 112, 109]}, {"name": "Angi", "values": [140, 131, 126]}
]}
</script>
</figure>
</div>
</div>
</section>
<!-- 5. Rules -->
<section class="sec">
<div class="sec-head">
<div><div class="divider"></div><p class="eyebrow">05 Rules</p><h2>Eight rules, no exceptions</h2></div>
<p class="small">Charts are flat. No drop shadows, gradients, 3D, or decorative icons. If an element does not help someone read a number, it comes out.</p>
</div>
<div class="rules">
<div class="rule"><h3>The title is the finding</h3><p>"Local Services Ads brought in 74 of 212 leads," not "Leads by channel." The eyebrow carries the topic.</p></div>
<div class="rule"><h3>One red per chart</h3><p>The highlight marks the thing the title names. A second highlight is ignored by the kit.</p></div>
<div class="rule"><h3>Label it, do not key it</h3><p>Names sit at the bar end or the line end. No legends, ever. If a label does not fit, the chart is too busy.</p></div>
<div class="rule"><h3>Bars start at zero</h3><p>Bars and columns always sit on a zero baseline. Lines may start above zero only when the axis says so.</p></div>
<div class="rule"><h3>Horizontal gridlines only</h3><p>1px Gray 200, and only on line charts. Bars carry their values, so they need no grid.</p></div>
<div class="rule"><h3>Tabular figures</h3><p>Every number is Montserrat with tabular figures, so columns of numbers line up in print and on a phone.</p></div>
<div class="rule"><h3>Four series at most</h3><p>More than four lines or segments and the kit refuses to draw. Group the small ones into Other, or split the chart.</p></div>
<div class="rule"><h3>Say where it came from</h3><p>Every chart ends with a source line: the system, the date range, and what was counted.</p></div>
</div>
</section>
<footer class="foot"><span>Marathon Creative, chart kit v1.0. charts.css and charts.js, tokens from tokens.css.</span><span>Example figures pending Jacob's confirmation.</span></footer>
</div>
<script>
/* Live contrast checks. Reads each token through the browser, never from a typed value. */
(function () {
var probe = document.createElement('span');
document.body.appendChild(probe);
function rgba(token) {
probe.style.color = 'var(' + token + ')';
var m = getComputedStyle(probe).color.match(/[\d.]+/g).map(Number);
return { r: m[0], g: m[1], b: m[2], a: m.length > 3 ? m[3] : 1 };
}
function over(c, bg) {
return { r: c.r * c.a + bg.r * (1 - c.a), g: c.g * c.a + bg.g * (1 - c.a), b: c.b * c.a + bg.b * (1 - c.a), a: 1 };
}
function lin(v) { v /= 255; return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); }
function lum(c) { return 0.2126 * lin(c.r) + 0.7152 * lin(c.g) + 0.0722 * lin(c.b); }
function lstar(c) { var y = lum(c); return y > 0.008856 ? 116 * Math.cbrt(y) - 16 : 903.3 * y; }
function ratio(a, b) { var x = lum(a), y = lum(b); return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05); }
var white = rgba('--mc-surface-page');
document.querySelectorAll('#swatches .sw').forEach(function (row) {
var c = over(rgba(row.getAttribute('data-token')), white);
row.querySelector('.cr').textContent = ratio(c, white).toFixed(1) + ':1';
row.querySelector('.ls').textContent = 'Grey L* ' + Math.round(lstar(c));
});
document.querySelectorAll('#pairs tbody tr').forEach(function (tr) {
var b = rgba(tr.getAttribute('data-b'));
var a = over(rgba(tr.getAttribute('data-a')), b);
var r = ratio(a, b);
var min = parseFloat(tr.getAttribute('data-min'));
tr.querySelector('.cr').textContent = r.toFixed(2) + ':1';
tr.querySelector('.dl').textContent = Math.round(Math.abs(lstar(a) - lstar(b)));
var res = tr.querySelector('.res');
var ok = r >= min;
res.textContent = ok ? tr.getAttribute('data-ok') : tr.getAttribute('data-no');
res.className = 'res ' + (ok ? 'pass' : (tr.getAttribute('data-nocls') || 'never'));
});
probe.remove();
})();
</script>
</body>
</html>






