Skip to content

circle ​

Draws a circle for each data item. A convenience wrapper around ellipse with equal width and height.

js
gf.chart([{ size: 40 }])
  .mark(gf.circle({ r: 40, fill: "coral" }))
  .render(root, { w: 150, h: 150 });

Signature ​

ts
circle({ r?, fill?, stroke?, strokeWidth?, opacity?, debug? })

Parameters ​

A circle, drawn as an aspect-locked ellipse. Does NOT support the boxDims positioning channels directly (JS circle() in marks/chart.ts destructures only r/fill/stroke/strokeWidth/opacity) — position it via spread/scatter.

OptionTypeDefaultDescription
rnumber | string | FieldExprRadius; becomes w=h=2r on the underlying ellipse.
fillstring | FieldExprFill color, or a field name for a color scale.
strokestring | FieldExprStroke color. Defaults to fill.
strokeWidthnumber0Stroke width in pixels.
opacitynumber1Opacity, 0 to 1, applied to fill and stroke. In JS it may also be a per-datum accessor or a live(...) value; only a literal number crosses the wire.
debugbooleanDev-only flag: logs this mark's key and datum to the console as it is built. It changes nothing about what is drawn.

Examples ​

ts
// Fixed size circle
.mark(circle({ r: 10, fill: "steelblue" }))

// Circle with stroke
.mark(circle({ r: 15, fill: "white", stroke: "black", strokeWidth: 2 }))

// Named for use with selectAll()
.mark(circle({ r: 8 }).name("points"))

// Per-datum opacity: fade everything but the current day
.mark(circle({ r: 3, fill: "species", opacity: (d) => (d.day === day() ? 1 : 0.1) }))