class Geometry · Computations

SeparateCirclesAlongAxisOptions

Options for Separate.circlesAlongAxis.

All fields are optional. Numbers can be given as plain numbers or as reactive values; the value they hold when the function runs is used.

Properties

maxoptional

max?: number | Real

The largest coordinate across the axis that a circle may reach with its edge (default: no limit): y for "x", x for "y"; for a vector, the position projected onto the direction to its right.

minoptional

min?: number | Real

The smallest coordinate across the axis that a circle may reach with its edge (default: no limit): y for "x", x for "y"; for a vector, the position projected onto the direction to its right.

obstaclesoptional

obstacles?: Circle[]

Circles that are not moved but kept clear of, e.g. the one the user drags. They are not part of the result.

paddingoptional

padding?: number | Real

The smallest gap between two circles (default 0).

previousoptional

previous?: SeparatePrevious

The layout of the last update, for updates that should not rearrange the circles, e.g. while dragging or when some circles are added. Without it, every call places the circles afresh.

Meant for small, continuous changes (e.g. bubbles animated between years, dragging): after a larger change (another sample, another side, the axis turned and back) the kept sides or order no longer fit the new positions and the swarm stays loose and lopsided; place the circles afresh then (without previous).

shrinkoptional

shrink?: boolean

What happens when the circles don't fit between min, max, the obstacles and the circles that stay put. false (default): they keep their size and the gaps between them are reduced by a common factor, so they overlap evenly. true: all radii are made smaller by the largest common factor at which they fit (the padding and the obstacles keep their size), e.g. for a Dorling cartogram in a fixed frame.

sideoptional

side?: "left" | "right" | "both"

The side of the axis the circles may move to: "left", "right" or "both" (default). Left and right as seen along the axis: for "x" left is up, for "y" (pointing up) left is left, for a vector or pin as everywhere in the GDK. E.g. a beeswarm along the x axis that grows only upwards: side: "left".

weightsoptional

weights?: number[]

One weight per circle, in the order of the circles: a circle with a higher weight moves less, one with weight Infinity stays where it is, one with weight 0 moves freely. A missing weight (or NaN) counts as 1.