Table kit
The table layer of the kits - the column model of the core, figure cells drawn live in both palettes, and a table that drives the chart next to it.
The table kit is the table layer of the library: @unifin/chart-core owns the column model, the
sorting, the figure cells and the export, and @unifin/chart-react owns the table widget. There is no
extra package to install - a host that already uses the core and the binding has the whole layer, and the
domain kits feed it their rows.
For a worked book with the whole chain - SID, accounts, sub-balances, settlement agent and broker - see Balances table layouts.
Mini figures of the table layer, drawn live by @unifin/chart-core - nothing here is an image.
A table answers "how much"; an instrument row also has to answer "where the value came from", "how large it is against the rest", "is the row trustworthy" and "what happens if". Mini figures carry that second half inside the cell, so the reader never leaves the row.
- Sparkline
sparklineWhere the value came from over the window
Sixteen closes of one instrument
- Delta bar
deltaBarHow far and which way a signed value moved
Day change +0.42 % against the full range
- Inline bar
inlineBarHow large the value is against the column maximum
Coupon 42 against a 100 bp column maximum
- Micro bars
microBarsThe shape of a small series (volume, prints)
Ten prints of one session, open marked
- Heat strip
heatStripMonthly or bucket returns at a glance
Twelve monthly returns, sign and size
- Share stack
miniStackWhat the group is made of
Four rating buckets of a portfolio
- Scale mark
scaleMarkWhere a rating or tenor sits on its scale
Rating BBB on the AAA to D scale
- Quality strip
qualityStripWhich fields are filled and which are stale
Eight fields, the sixth stale
- Timeline strip
timelineStripWhen the events of the row happen
Seven cash-flow dates: coupons, an offer, the maturity
- Distribution
miniDistributionThe spread of the column around its median
Yield of the screened universe, median and kept range
- Gauge
miniGaugeUtilisation of a limit as one arc
Limit utilisation 72 %
- Mini waterfall
miniWaterfallHow the pieces build the total
Attribution of a portfolio result
- Depth ladder
miniLadderBid and ask depth around the mid
Bid and ask depth around the mid
- Risk ladder
riskLadderWhere the stop and the target sit against the entry
Entry 812, stop 805, target 828 - a 2.3 R order
- Status funnel
statusFunnelHow many items reached each stage
Payments per stage, the fourth short
- IV matrix
ivMatrixImplied volatility across strikes and expiries, with the smile
Two expiries and five strikes: the smile of every row
- Payoff curve
payoffCurveWhere the strategy wins, where it loses and where it breaks even
A long call: the break-even at 100 and the profit after it
- Greek bars
greekBarsThe greeks of the position in one signed row
Delta, gamma, vega and a negative theta
- Term curve
termCurveThe futures curve with the open interest under it
Five futures in contango with the open interest under the curve
- Correlation matrix
correlationMatrixHow the members move together, cell by cell
Four names: two move together, one moves apart
- Scenario cone
scenarioConeThe band a shock spreads over the horizon
A stress cone: the band widens with the horizon
- Balance timeline
balanceTimelineHow the account balance stepped through the window
Twelve settlements: the balance holds, then jumps, and dips once
- Cash-flow ladder
cashflowLadderInflows and outflows per period with the running total
Inflows above the line, outflows below, the running total over them
- Limit bar
limitBarHow much of a limit is used and where the breach starts
Sixty percent of the limit used, the breach starts at eighty
- Agreement scatter
agreementScatterExpected against actual, with the diagonal and the breaks
Expected against actual: three breaks above the diagonal of agreement
Figure columns of the data table
A column declares its figure, and every visible row draws it next to the number:
const columns: TableColumn<Row>[] = [
{
id: 'trend',
title: 'Trend',
kind: 'number',
digits: 2,
value: (row) => row.closes.at(-1) ?? null,
figure: {
kind: 'sparkline',
values: (row) => row.closes,
label: (row) => `${row.symbol} trend, last sixteen closes`,
},
},
];
<DataTable columns={columns} rows={rows} getRowKey={(row) => row.symbol} />;The figure repeats the number, it never replaces it: the column keeps value, so sorting, filtering and
copying work unchanged. A cell whose figure has nothing to draw - an empty window, a non-finite value, a
column without a figure spec - renders the number alone, without an exception.
A host that renders for a locale passes it down: <DataTable locale="de-DE" ... /> reformats every
numeric cell through the table model - grouping and the decimal separator follow the locale, while the
digits and the unit of each column stay as the kit declares them. The live boards on the
bonds, portfolio and options kit pages
carry a switch that shows the same rows in en-US, de-DE and ru-RU.
The board below runs five figure columns off one shared canvas pool. The counters come from the pool itself, and a virtualised board holds canvases for the visible rows only, so a long table keeps the same bound:
| AKMG.0630 | 100.49 | 0.96 | 157 | BBB- | 6 of 8 |
| RDGR.0432 | 95.69 | 0.80 | 185 | B+ | 6 of 8 |
| BTPR.1131 | 107.99 | 0.80 | 189 | BB | 7 of 8 |
| KZAP.0720 | 102.11 | 0.71 | 234 | B | 6 of 8 |
| USDK.0524 | 106.83 | 0.65 | 316 | A | 6 of 8 |
| KZIK.0619 | 107.37 | 0.51 | 120 | B+ | 7 of 8 |
| BAC.0431 | 97.64 | 0.14 | 337 | BB+ | 7 of 8 |
| CCBN.0928 | 103.97 | 0.07 | 188 | A- | 7 of 8 |
| KZSP.0417 | 103.77 | -0.16 | 138 | BB- | 5 of 8 |
| KZGB.0329 | 97.33 | -0.17 | 113 | BBB- | 6 of 8 |
| AAPL.0527 | 98.72 | -0.31 | 308 | BB | 7 of 8 |
| KEGC.0829 | 99.85 | -0.65 | 255 | BBB | 5 of 8 |
Canvas pool: 0 created, 0 reused, 0 in use of 0. A virtualised board holds canvases for the visible rows only, so 100 000 rows use the same pool.
Two rules keep the pool honest: a canvas is borrowed for a cell and returned when the row leaves, and a cell that cannot get one degrades to its number - the pool never grows past its limit to hide a leak.
Column kinds and signed scales
A financial board needs five kinds the plain model does not have: basis points, money with a currency code, tenor, rating and boolean. They are declared in the column, so alignment, sorting, filtering and copying keep working:
const columns: TableColumn<Row>[] = [
{ id: 'coupon', title: 'Coupon', kind: 'bp', digits: 1, signed: true, value: (row) => row.couponBp },
{ id: 'notional', title: 'Notional', kind: 'money', currency: 'USD', value: (row) => row.notional },
{ id: 'tenor', title: 'Tenor', kind: 'tenor', value: (row) => row.tenorMonths, inlineBar: true },
{
id: 'rating',
title: 'Rating',
kind: 'rating',
value: (row) => row.rating,
pills: (row) => [{ text: row.rating, tone: 'warn' }],
},
];Three rules keep the cells honest:
signedtones the cell by the sign of the value, whiletonestays the function form for rules that are not about the sign;inlineBardraws a thin bar under the number against the column maximum, so the reader sees the size before reading the figure;- a pill carries text and a tone, never an icon font or an emoji, and the vocabulary of statuses comes from the platform, not from the library.
| KZ2C0000719 | 125.0 bp | USD 1,250,000.50 | 2Y6M | BBB- | GreenCovenant |
| KZ2C0000883 | 135.1 bp | USD 42,000.00 | 3M | AAA | No |
| KZ2C0000941 | 134.5 bp | USD 875,000.00 | 1Y | BB+ | Covenant |
| KZ2C0001024 | 120.7 bp | USD 9,600,000.00 | 7Y | B+ | Green |
| KZ2C0001156 | 101.0 bp | USD 315,000.00 | 5Y | A- | Covenant |
| KZ2C0001208 | 87.4 bp | USD 2,050,000.00 | 1Y6M | BBB | GreenCovenant |
The coupon column is signed, so the tone follows the sign of the value; the tenor column carries an inline bar against the column maximum; a cell whose value changed flashes in the direction of the move and stays still under prefers-reduced-motion.
Column histogram, brush and sort chain
The head of a numeric column is the cheapest place to answer "what is in this column":
<DataTable
columns={columns}
rows={rows}
getRowKey={(row) => row.symbol}
histogram={{ buckets: 18, brush: true }}
onRangeFilter={(columnId, range) => setRange(range === null ? null : { columnId, ...range })}
rangeFilter={range}
loadingProgress={loading}
initialSorts={[{ key: 'ytw', direction: 'desc' }]}
/>;- the histogram is drawn from the column values, marks the median and shows the applied range as a band;
- the brush needs
Shifton purpose: a plain drag keeps selecting text, which is what a reader expects in a table of numbers, and a range that was set can always be cleared; - a header click replaces the sort,
Shift-click appends a key (up to three, each with its priority number), and the same key cycles its direction; loadingProgressdraws the load strip over the numeric headers while history is fetched.
| KZ2238 | 10.41% | 91.00 | 3Y2M | BBB | 2,908 |
| KZ2252 | 9.84% | 100.93 | 7Y10M | AA- | 2,185 |
| KZ2147 | 9.38% | 98.20 | 9Y1M | A | 1,201 |
| KZ2098 | 9.15% | 92.27 | 5Y2M | A+ | 2,983 |
| KZ2028 | 8.69% | 90.45 | 11M | BBB+ | 556 |
| KZ2049 | 8.52% | 95.78 | 8Y2M | B+ | 3,592 |
| KZ2070 | 8.41% | 90.13 | 4Y8M | BBB- | 2,028 |
| KZ2021 | 8.22% | 93.90 | 3Y | AAA | 1,435 |
| KZ2266 | 8.18% | 96.79 | 5Y8M | A+ | 3,388 |
| KZ2042 | 8.11% | 98.03 | 2Y2M | BB+ | 164 |
| KZ2210 | 8.04% | 96.67 | 8Y5M | A+ | 3,761 |
| KZ2000 | 7.92% | 89.56 | 6Y4M | BB- | 2,747 |
| KZ2091 | 7.84% | 96.51 | 4Y4M | A+ | 1,082 |
| KZ2077 | 7.52% | 89.10 | 6Y7M | B+ | 1,766 |
| KZ2133 | 7.49% | 92.61 | 5Y6M | AA- | 389 |
| KZ2203 | 7.20% | 93.48 | 5Y9M | BBB | 3,846 |
| KZ2196 | 7.11% | 90.68 | 2Y10M | A- | 44 |
| KZ2007 | 7.04% | 88.83 | 6Y3M | BBB- | 3,630 |
| KZ2154 | 6.95% | 95.21 | 5Y6M | BB- | 126 |
| KZ2175 | 6.94% | 94.11 | 9Y1M | BB | 3,068 |
| KZ2084 | 6.69% | 96.26 | 4Y8M | A | 87 |
| KZ2063 | 6.62% | 93.46 | 6Y4M | BBB- | 1,943 |
| KZ2112 | 6.32% | 92.26 | 5Y6M | A- | 742 |
| KZ2140 | 6.29% | 92.96 | 7Y7M | AA- | 3,812 |
| KZ2189 | 6.28% | 99.05 | 10M | BB+ | 1,662 |
| KZ2014 | 6.23% | 97.43 | 7Y7M | A- | 2,858 |
| KZ2217 | 6.14% | 89.12 | 8Y6M | A- | 1,418 |
| KZ2273 | 6.11% | 98.40 | 5M | A | 3,585 |
| KZ2056 | 5.96% | 96.08 | 2Y7M | BB- | 3,498 |
| KZ2231 | 5.89% | 99.28 | 7Y6M | AAA | 1,207 |
| KZ2168 | 5.76% | 89.58 | 4Y3M | AAA | 3,437 |
| KZ2126 | 5.69% | 88.31 | 2Y11M | A- | 1,135 |
| KZ2161 | 5.62% | 98.01 | 3Y | BBB- | 2,461 |
| KZ2105 | 5.11% | 96.24 | 7Y4M | BBB | 1,514 |
| KZ2245 | 4.82% | 88.65 | 5Y6M | A- | 1,848 |
| KZ2259 | 4.80% | 96.43 | 1Y4M | AA- | 2,448 |
| KZ2119 | 4.60% | 89.61 | 2Y2M | BB | 2,200 |
| KZ2035 | 4.57% | 90.21 | 3Y1M | BB | 2,851 |
| KZ2182 | 4.57% | 97.62 | 4M | B+ | 4,003 |
| KZ2224 | 4.54% | 91.48 | 7Y6M | AAA | 3,763 |
40 of 40 rows shown, no range applied. Shift-click a header to add a second sort key; a plain drag still selects text.
Sharing one selection with the chart
The link is a public contract of the core, createTableChartLink, and it carries one reference: the row key,
the series the row points at and the time the row is about.
import { createTableChartLink } from '@unifin/chart-core';
const link = createTableChartLink({ group: 'board' }); // crosshair group of the host, optional
link.onRow((event) => {
// event.ref: { key, seriesId, at }; event.from: 'table' | 'chart'
setRow(event.ref);
});<DataTable columns={columns} rows={rows} getRowKey={(row) => row.symbol} link={link}
rowRefOf={(row) => ({ key: row.symbol, seriesId: row.symbol, at: row.sessionDate })} />Four rules keep the link predictable:
- the row key is the one the host already uses, never a position in the current sort, so sorting does not move the selection;
- the same row published twice raises one event, so a pointer resting on a row does not repaint the chart;
- the row is the single source of the selection: the chart puts its crosshair on the row time and keeps no idea of "current" of its own;
- rows are reachable from the keyboard (
Tab, thenEnter) and the linked row carriesaria-current.
| RDGR.0432 | Corporate | 99.84 | 5.40% | 96.000 |
| KZGB.0329 | Government | 96.60 | 5.82% | 97.400 |
| BAC.0431 | Bank | 102.49 | 6.24% | 98.800 |
| AAPL.0527 | Corporate | 106.43 | 6.66% | 100.200 |
| KEGC.0829 | Utility | 105.41 | 7.08% | 101.600 |
| AKMG.0630 | Municipal | 107.70 | 7.50% | 103.000 |
No row under the pointer
Hierarchy, group totals and export
An issue is not a leaf: it has tranches, a position has lots, a strike has a call and a put. The board carries the tree and the totals of a group, and the columns declare what a total means:
// The model flattens what is visible and totals the children of a group.
const tree = { childrenOf: (row: Issue) => tranchesOf(row.isin) };
const columns: TableColumn<Issue>[] = [
{
id: 'nominal',
title: 'Nominal',
kind: 'money',
value: (row) => row.nominal,
aggregate: sumAggregate((row) => row.nominal), // a book adds up
},
{
id: 'ytw',
title: 'YTW',
kind: 'percent',
value: (row) => row.ytw,
aggregate: weightedAverageAggregate((row) => row.ytw, (row) => row.nominal), // a yield does not
},
];
<DataTable columns={columns} rows={roots} getRowKey={(row) => row.isin} tree={tree} stickyFirst
onCopy={(text, format) => log(format, text)} />;- a column without an aggregate shows nothing in a group line, because a sum of yields is not a yield;
- the first column can stay put while the board scrolls sideways (
stickyFirst), which is what makes a wide financial board readable; - the caption copies the board as TSV or CSV: the table builds the text itself, the host receives it and
can write a file (the PDF path stays in
buildChartPdf, where the chart frame is added).
| RDGR 2031 | USD 1,500,000,000 | 7.25% | 5Y | BBB- | 6,300 |
| Total of 2 entries | USD 1,500,000,000 | 7.27% | - | - | 6,300 |
| RDGR 2031 | USD 1,500,000,000 | 7.25% | 5Y | BBB- | 6,300 |
| KZ2C0000719-t1 | USD 900,000,000 | 7.41% | 5Y | BBB- | 3,780 |
| KZ2C0000719-t2 | USD 600,000,000 | 7.06% | 6Y | BBB- | 2,520 |
| KZGB 2029 | USD 900,000,000 | 6.40% | 3Y | A- | 3,780 |
| BAC 2033 | USD 1,200,000,000 | 8.10% | 7Y | BB | 5,040 |
Copy TSV or CSV from the caption, the board builds the text itself.
Basket of rows, actions and edits
A reader rarely wants one row: a book is a basket of holdings, and the numbers that matter belong to the basket, not to a row. Three pieces of the layer turn a selection into one thing:
import { basketMetrics, basketSeries, timeFilterFromCursor } from '@unifin/chart-core';
// One weighted figure over the ticked rows.
const metrics = basketMetrics({
members: keys.map((key) => ({ key, weight: nominalOf(key) })),
valueOf: (key) => yieldOf(key),
sumOf: (key) => nominalOf(key),
});
// Their composite, aligned by time and normalised, so a basket of ten draws like a basket of two.
const composite = basketSeries(seriesOf(keys), { mode: 'normalised' });
// The cursor of the chart, read the other way round: the rows of one bucket.
const filter = timeFilterFromCursor(rows, cursor, (row) => row.tradedAt);<DataTable
columns={columns}
rows={visible}
getRowKey={(row) => row.isin}
selectable
initialSelectedKeys={['KZ2C0000719', 'KZ2C0000941']}
onSelectionChange={setKeys}
rowActions={(row) => [{ id: 'watch', label: 'Watch', onSelect: () => watch(row) }]}
editable={(column, row) =>
column.id === 'nominal'
? { value: row.nominal, min: 0, max: 2_000_000_000, onCommit: (value) => commit(row, value) }
: null
}
/>;Four rules keep the basket honest:
- the selection is a set of row keys, so sorting and filtering never move it, and the keys leave the table as the host's own identifiers - the basket survives a re-sort because it never referred to a position;
- the arithmetic lives in the core, not in the board: the same
basketMetricsanswers a React table, a custom element and an export, and a member with a missing weight stays in the count but leaves the mean; - a row action is a button with a label from the host (watch, add to a portfolio, open in the chart); the library ships no icons and no menu of its own;
- an editable cell only opens on a deliberate gesture, commits through the host callback - which is the only party that knows the rules - and shows the range it may take, so an out-of-range entry is visible before it is written back.
| KZ2C0000719 - RDGR 2031 | USD 1,500,000,000 | 7.25% | 99.38 | 2026-09-01 | ||
| KZ2C0000883 - KZGB 2029 | USD 900,000,000 | 6.40% | 99.87 | 2026-09-02 | ||
| KZ2C0000941 - BAC 2033 | USD 1,200,000,000 | 8.10% | 96.45 | 2026-09-03 | ||
| KZ2C0001015 - NASDAQ 2028 | USD 600,000,000 | 5.88% | 93.85 | 2026-09-04 |
Tick two holdings: the bar turns them into one weighted figure, the chart draws their composite.
Derivatives: the surface, the payoff and the greeks
A derivative row has no single number: an option is a surface plus a payoff, a future is a curve, a book is a correlation table. The family carries six more primitives for that:
import { paintIvMatrix, paintPayoffCurve, paintGreekBars, paintTermCurve, paintCorrelationHeat, paintScenarioCone } from '@unifin/chart-core';
// One cell per strike and expiry; the smile of every row is drawn through the
// cheapest strike of that row.
paintIvMatrix(ctx, { strikes, expiries, vols }, box);
// The payoff against the underlying, with a mark on every break-even.
paintPayoffCurve(ctx, payoff, box);
// Delta, gamma, vega and theta in one signed row: a negative theta has to be visible.
paintGreekBars(ctx, [delta, gamma, vega, theta], box);
// The futures curve with the open interest under it - a flat curve without interest
// is not a signal.
paintTermCurve(ctx, settlePrices, box);
// The correlation of the book: the diagonal stays empty, because a name is always
// correlated with itself.
paintCorrelationHeat(ctx, { labels, values }, box);
// The band a shock spreads over the horizon, with the value of today marked.
paintScenarioCone(ctx, { base, lower, upper }, box);<DataTable
columns={columns}
rows={contracts}
getRowKey={(row) => row.id}
onRowSelect={(row) => setFocus(row.id)}
/>;Four rules of the derivative figures:
- a surface, a correlation table and a cone are passed as structures, not as flat samples: flattening them would be ambiguous, and the painter is the one place that validates the shape;
- the smile, the break-even and the open-interest bars are part of the primitive: a reader should not have to reconstruct them from numbers beside the cell;
- the greeks are signed bars around the middle line, and a greek that is not a number is dropped instead of being drawn as zero;
- the board composes the cell figures with the same painters on a larger canvas, so one implementation serves both the cell and the side panel.
| OPT-2431 - RDGR call 105, 30 days | 214.5 | 21.4 | 133.0 | 0.62 | 21.4 | 30 days |
| OPT-2432 - RDGR put 95, 30 days | 118.2 | 23.7 | -44.9 | -0.38 | 23.7 | 30 days |
| FUT-2603 - AAPL future, March | 1014.0 | 101.4 | 1014.0 | 1.00 | 101.4 | 74 days |
| STR-01 - Covered call 105/115 | 268.9 | 19.8 | 118.3 | 0.44 | 19.8 | 45 days |
The matrix and the cone come from the same core painters the cells use, from the same numbers: the host owns the layout, the library owns the drawing.
Portfolio, depository and money
A position row carries the heat of its months, and the questions of a book - what is the allocation, how deep was the drawdown, does the account survive the month - are answered next to it, not in another screen:
import { paintBalanceTimeline, paintCashflowLadder } from '@unifin/chart-core';
// Money does not move between two settlements: the line steps, the part below zero is
// tinted as a violation and the lowest point of the window carries a mark.
paintBalanceTimeline(ctx, dailyBalances, box);
// One column per period, inflows above the line and outflows below, with the running
// total over them - the question is whether the account survives the month.
paintCashflowLadder(ctx, periodFlows, box);<DataTable columns={columns} rows={positions} getRowKey={(row) => row.symbol} onRowSelect={setFocus} />;Three rules of the money figures:
- the balance steps and never slopes: a sloping line would claim a continuous change the ledger does not have, and an account below zero has to be visible without reading the number;
- the running total of the cash-flow ladder is the point of the figure, so the columns share one scale and the total keeps its own;
- an instruction carries its stage in the row (a funnel of the stages and a status pill), because the stage is what the reader acts on.
| AAPL - Apple Inc. | 28.0% | 420.0% | 1.1 |
| KZAP - Kazatomprom | 22.0% | -160.0% | -0.7 |
| BAC - Bank of America | 19.0% | 280.0% | 1.2 |
| RDGR - RDGR 2031 | 17.0% | 110.0% | 0.2 |
| KEGC - KEGOC | 14.0% | -90.0% | 0.9 |
The table owns the weights; the donut and the waterfall are drawn by the portfolio kit and the core from the same numbers.
| DEPO-101 (main) | USD 430 | USD 398 | Covered | DEPO-101 (main) |
| DEPO-102 (clients) | USD 190 | USD 156 | Covered | DEPO-102 (clients) |
| DEPO-103 (fund) | USD 45 | USD 55 | Overdrawn | DEPO-103 (fund) |
The balance timeline and the cash-flow ladder are core figures: the account that went below zero carries the warning mark and the overdrawn pill in the same row.
Compliance, limits and the journal of a row
A compliance reader asks four things about a row: how much of the limit is used, where the breach starts, who changed the row and whether its sources are fresh. All four fit in the row:
import { paintLimitBar } from '@unifin/chart-core';
// Utilisation against the ceiling with the threshold marked on the track; the part
// above the threshold takes the violation colour.
paintLimitBar(ctx, { used: 1420, limit: 1500, warnAt: 1200 }, box);<DataTable
columns={columns}
rows={limits}
getRowKey={(row) => row.id}
/>;Three rules of the compliance figures:
- the breach is drawn, not described: the excess over the threshold has its own colour, so the state of a row is visible before the number is read;
- the journal of a row is a timeline strip of its changes plus a pill with the author: the figure answers when, the text answers who, and neither pretends to do the other's job;
- freshness is a strip of the sources with the stale one flagged (
qualityStrip), because a limit computed from a stale source is a different statement about the same row.
| LIM-01 - Fixed income | 62.0% | Within limitA. Sultanov | 3 | 5 |
| LIM-02 - Equities | 94.7% | Above thresholdD. Iskakova | 3 | 5 |
| LIM-03 - Depository | 34.4% | Within limitSystem | 1 | 5 |
A breach is a fact of the row: the excess takes the violation colour and the pill names the state, so the reader does not have to compare two numbers to see it.
Reconciliation: expected against actual
Two books of the same thing - a clearing statement and the ledger, a portfolio and its custodian - are compared row by row, and the difference is the answer the reader needs:
import { asOfGap, asOfVersion, reconcile, reasonWaterfall, reconciliationSummary, reconciliationToText } from '@unifin/chart-core';
const entries = reconcile(rows, {
tolerance: 1, // absolute, in the currency of the books
pairOf: (row) => ({ key: row.key, expected: row.expected, actual: row.actual, reason: row.reason }),
});
const summary = reconciliationSummary(entries); // matched, broken, net and gross difference
const steps = reasonWaterfall(entries); // what caused the difference, largest first
const report = reconciliationToText(entries); // text the host can export
const before = asOfVersion(history, '2026-10-06'); // the last version of every key as of a date
const after = asOfVersion(history, '2026-10-08');
const gap = asOfGap(before, after); // changed, added and removed rowsA saved view keeps the arrangement of the board, not the data:
import { applyTableViewColumns, parseTableView, serializeTableView } from '@unifin/chart-core';
const payload = serializeTableView(view); // stable key order, comparable text
const restored = parseTableView(payload); // null on a broken or foreign payload
const columns = applyTableViewColumns(restored ?? view, columns); // view order wins, new columns appendedFour rules of a reconciliation:
- the tolerance is absolute by default: a relative one hides a small break inside a large number, and the reader of a clearing statement wants the currency amount;
- a pair the host cannot express as two finite numbers is reported as broken, not skipped: silence about a missing number is the one answer a reconciliation must never give;
- a row is read as of a date, and the gap names what changed, appeared and disappeared - the versions are compared by the host object, so a stale flag moving is a change;
- the report leaves the screen as text (TSV or CSV), because a break has to be signed off by someone who is not looking at the board.
| AAPL - Apple Inc. | USD 1,000,000 | USD 1,000,000 | USD 0 | 1000000 | Matched |
| BAC - Bank of America | USD 250,000 | USD 250,400 | USD 400 | 250400 | Rounding |
| KZAP - Kazatomprom | USD 500,000 | USD 480,400 | USD -19,600 | 480400 | Commission |
| RDGR - RDGR 2031 | USD 0 | USD 12,000 | USD 12,000 | 12000 | Coupon accrued |
- Commission (1)-19,600
- Coupon accrued (1)+12,000
- Rounding (1)+400
Compare the two books, then export the report. Between 2026-10-06 and 2026-10-07 the book changed 1, gained 0 and lost 0 rows.
The linking pattern
A figure cell is useful on its own, but the reason a financial table belongs to a charting library is the
link: the row and the chart share one selection. Hovering a row moves the chart, the keyboard does the
same with Tab and Enter, and a click pins the choice so the pointer can move away.
| Symbol | Trend | YTW | Price | Rating |
|---|---|---|---|---|
| RDGR.0432 | 5.40% | 96.000 | B+ | |
| KZGB.0329 | 5.82% | 97.400 | BBB- | |
| BAC.0431 | 6.24% | 98.800 | BB+ | |
| AAPL.0527 | 6.66% | 100.200 | BB | |
| KEGC.0829 | 7.08% | 101.600 | BBB | |
| AKMG.0630 | 7.50% | 103.000 | BBB- |
RDGR.0432 - Corporate, sixty sessions, hover to compare
Three rules make the link predictable:
- the row is the single source of selection - the chart never holds its own idea of "current";
- the link uses the row key the host already has (
getRowKey), not a position in the current sort; - hiding a row (filter, collapse) clears the selection instead of leaving the chart on a hidden row.
Using a figure cell
import { paintMiniFigure, resolveThemeByName } from '@unifin/chart-core';
const theme = resolveThemeByName('dark');
// 208 x 30 CSS pixels inside the cell, device pixel ratio applied by the host.
paintMiniFigure(context, 'sparkline', closes, { width: 208, height: 30, theme });<canvas
role="img"
aria-label="RDGR.0432 trend, last sixteen closes"
style={{ width: '208px', height: '30px' }}
ref={canvasRef}
/>The painter draws into any canvas-like context, so a cell, a tooltip row or a printed report share one implementation. A figure keeps its numbers in the host: the cell paints, it never computes.
The primitives
| Figure | Answers | Typical column |
|---|---|---|
sparkline | Where the value came from over the window | Price, yield, position |
deltaBar | How far and which way a signed value moved | Day change, P&L, spread |
inlineBar | How large the value is against the column maximum | Coupon, volume, exposure |
microBars | The shape of a small series | Prints, intraday volume |
heatStrip | Monthly or bucket returns at a glance | Returns, cash flow calendar |
miniStack | What the group is made of | Rating buckets, sector mix |
scaleMark | Where a rating or tenor sits on its scale | Rating, maturity, percentile |
qualityStrip | Which fields are filled and which are stale | Data coverage |
timelineStrip | When the events of the row happen | Coupons, settlements, audit |
miniDistribution | The spread of the column around its median | Universe screening |
miniGauge | Utilisation of a limit as one arc | Limits, margin |
miniWaterfall | How the pieces build the total | Attribution, reconciliation |
miniLadder | Bid and ask depth around the mid | Order book, liquidity |
statusFunnel | How many items reached each stage | Payments, onboarding |
What to keep in mind
- One canvas per cell is not free. A hundred thousand rows must not hold a hundred thousand contexts: paint only visible rows and reuse contexts through a pool, and measure before shipping a busy column.
- The figure repeats the number, it does not replace it. Keep the value as text in the neighbouring cell - a colour or a shape alone is not readable for everyone, and it is not searchable.
- Every figure needs a text equivalent. The canvas carries
role="img"and anaria-labelwith the value and its direction; the same sentence belongs in the accessible description of the row. - Colours come from the theme. A figure never hardcodes a palette: the cell stays correct in all six palettes and in a white-label shell.
See also
- Analytic figures - the larger analytic painters these cells borrow from.
- Bonds, portfolio and options kit pages - tables that use the figures in a working surface, with the number locale switch.
- Theming - palettes, tokens and what a host can restyle.
Options kit
Black-Scholes price and greeks, implied volatility, multi-leg payoff at expiry and now, greek profiles, the smile, the term structure, the surface and open interest by strike.
Balances table layouts
A generated depository book rendered by nine table layouts - SID, accounts, sub-balances, settlement agent, broker, paging and aggregation - plus a chart card over the same book.
