import { NetworkCustomChart } from "semiotic" import { networkHitTarget } from "semiotic/recipes" function railroadOrganizationLayout(ctx) { const { plot } = ctx.dimensions const root = { x: plot.width / 2, y: plot.height - 185 } const positions = new Map() divisions.forEach((division, i) => { // Five cubic trunks radiate from the general superintendent. const end = divisionEndpoint(i, plot) const trunk = cubicFrom(root, end) division.stations.forEach((station, j) => { const p = cubicPoint(trunk, 0.23 + j * 0.15) positions.set(station.id, p) // Workforce boughs grow normal to the trunk. Their leaf count and // color come from the crew datum, never from hand-authored x/y. station.crews.forEach((crew, k) => { positions.set(crew.id, growBough(p, cubicTangent(trunk, j), k)) }) }) }) return { sceneNodes: ctx.nodes.map((wrapped) => { const d = wrapped.data ?? wrapped const p = positions.get(d.id) return networkHitTarget({ x: p.x, y: p.y, r: hitRadius(d), datum: d, id: d.id }) }), overlays: <RailroadPlate positions={positions} config={ctx.config} /> } } <NetworkCustomChart nodes={nodes} edges={edges} layout={railroadOrganizationLayout} layoutConfig={{ view, employeeFilter }} // geometry-changing config only selection={{ name: "erie-active" }} // hover/lock restyles, no relayout annotations={editorialNotes} // anchored to computed node positions enableHover onObservation={handleObservation} // hover, click, keyboard focus accessibleTable />