ScaleXBinned

Binned x position scale: quantitative values map to ordered bins (breaks are bin boundaries).

Defaults

helper
scaleXBinned
family
position-binned
aesthetic
x
scale type
binned
options type
ContinuousPositionScaleOptions

Svelte component

import { GGPlot, GeomPoint, ScaleXBinned } from "@ggsvelte/svelte";

<GGPlot data={rows} aes={{ x: "x", y: "y" }}>
  <ScaleXBinned />
  <GeomPoint />
</GGPlot>

JSON scales

{
  "scales": {
    "x": {
      "type": "binned"
    }
  }
}

Params

limits

DomainValue[]

Pin the scale to [min, max] in source units (authoring sugar for domain). Supplying both limits and domain throws.

domain

Array<DomainValue>

Explicit domain, PINNING the scale: [min, max] for continuous scales (numbers, or temporal strings for time); the full category list for band scales. Data outside the domain is dropped with a warning.

nice

boolean

Round the inferred domain to tick-friendly bounds. Default true. Ignored when `domain` is set.

zero

boolean

Force the domain to include zero. Bars, columns, and areas force this to true on the measure axis; set false explicitly to override. Ignored when `domain` is set.

reverse

boolean

Reverse the scale's output direction. Default false.

breaks

Array<number | string>

Explicit tick positions in data units (numbers, or ISO date strings for time scales); for binned scales these are the bin boundaries. Omit for automatic ticks. Binned scales allow at most 65 boundaries (64 bins); non-binned explicit ticks are not capped.

labels

string

Tick label format string. Time scales: strftime-style ("%Y-%m", "%b %d", "%H:%M"). Numeric scales: ",d" (grouped integer), ".1f" (fixed decimals), ".0%" (percent), "~s" (SI prefix). Omit for automatic formatting.

expand

ScaleExpansion

Display-domain padding. Non-temporal continuous/binned axes default to { mult: 0.05, add: 0 }; time axes default to zero. Pinned domains still receive display expansion.

oob

"censor" | "squish"

Out-of-bounds policy for values outside explicit source limits, applied before stats. "censor" (default) drops them to missing; "squish" clamps them to the nearest source limit before transform.

naValue

number | unknown

Replacement for missing/censored positional values, resolved after OOB and before transform. A finite number substitutes; null (default) keeps them missing. The replacement is itself checked against the transform/domain rules.

minorBreaks

Array<number>

Explicit minor gridline positions in semantic source units. Coincident major/minor values render only the major tick. Time scales use dateMinorBreaks instead.

transform

"identity" | "log10" | "sqrt"

Pre-stat position transform applied after parsing and before grouping-sensitive stats/positions. "identity" (default), "log10" (base-10; source values must be > 0), "sqrt" (source values must be >= 0). Only "identity" is permitted on time scales.

guide

GuideSpec | BandAxisGuideSpec

Guide presentation override (legend, colorbar, colorsteps, or none).

Guide interaction

Axis guide on the position channel (band axis guide when type is band). Set guide to customize ticks/labels or guide: "none" to hide.

Examples

← All scales · Palettes · Scales and guides