Formula Chain

A pricing model on the left, its formula dependency graph on the right. Every formula is a card and every reference an edge, read straight from the calculation engine. Select a cell to trace what it reads and what reads it; edit a value and watch the recalculation travel through the chain.


How it works

  • worksheet.getPrecedents(cell) returns the references a formula reads: ranges are expanded to their cells, and a defined name to its range.
  • worksheet.getDependents(cell) returns the formulas that read a cell, which drives the recalculation animation, level by level.
  • onselection traces the selected cell: precedents in blue, dependents in orange. Clicking a card selects the cell.
  • onafterchanges, onundo and onredo rebuild the graph, so it always matches the sheet.

The diagrams use JointJS (MPL 2.0) with its directed graph layout.