Skip to content

Documentation / @ripl/charts / createSymbol

Function: createSymbol() ​

createSymbol(type, options): SymbolElement

Defined in: charts/src/components/symbols.ts:98

Creates a marker element for the given symbol type. The returned element exposes cx/cy/radius, so hosts treat every symbol identically for positioning and animation. Pass the equal-area circle radius through symbolRadius when sizing non-circle symbols.

Parameters ​

ParameterTypeDescription
typeSymbolTypeThe symbol shape to create.
optionsShape2DOptions<CircleState>Shape options (cx, cy, radius, paint, events). radius is applied as-is.

Returns ​

SymbolElement

A Circle for 'circle', otherwise a regular Polygon oriented for the shape.

Example ​

ts
const marker = createSymbol('triangle', {
    cx: 100,
    cy: 80,
    radius: symbolRadius('triangle', 4),
    fill: '#3b82f6',
});