# `Visualize.Hooks.Sync`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/hooks/sync.ex#L1)

The bus a sync group's tooltips and crosshairs share hover over, and its brushes the brushed
window (spec/10 §4.3, §6.4, D-116, D-117).

A design joins a group with `interaction: %{sync: "<group>"}` (spec/14 §2.9), and its
markup carries `data-vis-sync` and `data-vis-sync-x` — the group, and `d0,d1,x0,x1,width`:
the x domain, the chart pixels of its ends and the chart's width, from
`Visualize.Chart.Frame.sync_attrs/1`. `VisualizeSync` reads them and carries a hover
between members as a `CustomEvent` named `vis:sync:<group>` on `document`, whose
`detail` is `{x, source}`: the pointer's x in **domain** units (milliseconds since the
Unix epoch for a time x), `null` to clear, and the hook element that published it.
Each member maps the value through its own five numbers, so members may differ in
width, margin and domain; one whose domain does not hold the value draws nothing.

A brush travels on its own event, `vis:sync-brush:<group>`, whose `detail` is
`{extent, source}`: the brushed `[lo, hi]` in the same domain units, or `null` to clear.
A member draws it clipped to its own domain, and nothing when the two are disjoint.

The object is not exported: `TooltipHook`, `CrosshairHook` and `BrushHook` use it, and a host joins a
group through the design key, never through it.

# `js_bus`

Returns the JavaScript source of `VisualizeSync`, the bus of spec/10 §4.3.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
