import { focusGroupAngle } from './polar-focus-internal.js'; import type { Arc, CurveFactory, CurveFactoryLineOnly } from 'd3-shape'; import type { Channel, ChartAxisValue, ChartKey, ChartMark, ChartMarkRenderer, ChartMarkMotionOptions, ChartMotionDefinition, ChartNumericScale, MarkScene, ChartTheme, ChartValue, ChartScaleInput, OptionChannelOutput, OptionScaleId, SceneNode, VisualChannel } from './types.js'; import type { InitializedPolarMark as InternalInitializedPolarMark, PolarLayoutContext as InternalPolarLayoutContext, PolarMarkInitializeContext, PolarMarkRenderContext, PolarResolvedScale as InternalPolarResolvedScale } from './polar-mark-internal.js'; export { pie } from './polar-pie.js'; export { focusGroupAngle }; export type { PieDatum, PieOptions } from './polar-pie.js'; export type PolarPositionChannel = 'angle' | 'radius'; export interface PolarResolvedScale extends InternalPolarResolvedScale { id: string; channel: PolarPositionChannel; } export interface PolarLayoutContext extends InternalPolarLayoutContext { scales: Readonly>; /** @deprecated Read the reserved `angle` entry from `scales` instead. */ angle?: PolarResolvedScale; /** @deprecated Read the reserved `radius` entry from `scales` instead. */ radiusScale?: PolarResolvedScale; } interface InitializedPolarMark extends Omit, 'render'> { angleScale?: string; radiusScale?: string; render: (context: Omit & { layout: PolarLayoutContext; }) => MarkScene; } export interface PolarMark { initialize: (context: PolarMarkInitializeContext) => InitializedPolarMark; motion?: ChartMotionDefinition; renderer?: ChartMarkRenderer; readonly __datum?: TDatum; readonly __angle?: TAngle; readonly __radius?: TRadius; readonly __angleScaleId?: TAngleScaleId; readonly __radiusScaleId?: TRadiusScaleId; } export type PolarLength = number | ((context: PolarLayoutContext) => number); export interface PolarAngleOptions { scale: ChartScaleInput; channel?: 'angle'; nice?: boolean | number; /** * Avoids placing the first and last points at the same angle for point * scales. Defaults to true for a complete revolution and false for a * partial angular range. */ wrap?: boolean; } export interface PolarRadiusOptions { scale: ChartScaleInput; channel?: 'radius'; nice?: boolean | number; /** Responsive pixel range for the copied radius scale. Defaults to [0, radius]. */ range?: readonly [PolarLength, PolarLength]; } export type PolarPositionScaleOptions = PolarAngleOptions | PolarRadiusOptions; interface PolarGuideRenderContext { layout: PolarLayoutContext; theme: ChartTheme; guideIndex: number; parentId: string; } export interface PolarGuide { render: (context: PolarGuideRenderContext) => PolarGuideScene; } export interface PolarGuideScene { background: readonly SceneNode[]; foreground?: readonly SceneNode[]; } type AnyPolarMark = PolarMark; type PolarMarkDatum = TMark extends PolarMark ? TDatum : never; type PolarMarkAngle = TMark extends PolarMark ? TAngle : never; type PolarMarkRadius = TMark extends PolarMark ? TRadius : never; type PolarMarkScaleAngle = TMark extends PolarMark ? 'angle' extends TScaleId ? TAngle : never : never; type PolarMarkScaleRadius = TMark extends PolarMark ? 'radius' extends TScaleId ? TRadius : never : never; export type PolarScales = Readonly> & { angle: PolarAngleOptions>> | null; radius: PolarRadiusOptions>> | null; }; export interface PolarOptions extends ChartMarkMotionOptions> { id?: string; className?: string; marks: TMarks; guides?: readonly PolarGuide[]; scales?: PolarScales; /** @deprecated Move this value to `scales.angle`. */ angle?: PolarAngleOptions>>; /** @deprecated Move this value to `scales.radius`. */ radius?: PolarRadiusOptions>>; startAngle?: number; endAngle?: number; /** Pixel inset applied before radiusRatio. */ inset?: number; /** Multiplier applied to the final available radius. Defaults to 1. */ radiusRatio?: number; } export declare function polar(options: PolarOptions): ChartMark, PolarMarkAngle, PolarMarkRadius, never, never>; export interface RadialArcOptions extends ChartMarkMotionOptions { id?: string; className?: string; startAngle?: Channel; endAngle?: Channel; padAngle?: Channel; key?: Channel; z?: Channel; color?: Channel; innerRadius?: PolarLength; outerRadius?: PolarLength; cornerRadius?: PolarLength; padRadius?: PolarLength; /** * Replaces the default D3 arc configuration for per-datum radii, sunbursts, * and other advanced arc layouts. Keep its context null so it returns SVG * path data. */ generator?: (context: PolarLayoutContext) => Arc; fill?: VisualChannel; fillOpacity?: number; stroke?: VisualChannel; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; opacity?: number; } export declare function radialArc(source: Iterable, options?: RadialArcOptions>): PolarMark; interface RadialBarBaseOptions extends ChartMarkMotionOptions { id?: string; className?: string; /** Named angle scale. Omit to use the reserved `angle` scale. */ angleScale?: string; /** Named radius scale. Omit to use the reserved `radius` scale. */ radiusScale?: string; key?: Channel; z?: Channel; color?: Channel; cornerRadius?: PolarLength | 'full'; fill?: VisualChannel; fillOpacity?: number; stroke?: VisualChannel; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; opacity?: number; } export interface RadialBarRadiusOptions extends RadialBarBaseOptions { angle?: Channel; radius?: Channel; radius1?: number | Channel; radius2?: number | Channel; } export declare function radialBarRadius(source: Iterable): PolarMark; export declare function radialBarRadius> | undefined>(source: Iterable, options: TOptions): PolarMark, number, OptionScaleId, OptionScaleId>; export interface RadialBarAngleOptions extends RadialBarBaseOptions { angle?: Channel; angle1?: number | Channel; angle2?: number | Channel; radius?: Channel; } export declare function radialBarAngle(source: Iterable): PolarMark; export declare function radialBarAngle> | undefined>(source: Iterable, options: TOptions): PolarMark, OptionScaleId, OptionScaleId>; interface RadialPathOptions extends ChartMarkMotionOptions { id?: string; className?: string; /** Named angle scale. Omit to use the reserved `angle` scale. */ angleScale?: string; /** Named radius scale. Omit to use the reserved `radius` scale. */ radiusScale?: string; angle?: number | Channel; radius?: number | Channel; key?: Channel; z?: Channel; color?: Channel; } export interface RadialLineOptions extends RadialPathOptions { curve?: CurveFactory | CurveFactoryLineOnly; stroke?: VisualChannel; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; opacity?: number; points?: boolean; } export declare function radialLine(source: Iterable): PolarMark; export declare function radialLine> | undefined>(source: Iterable, options: TOptions): PolarMark, OptionChannelOutput, OptionScaleId, OptionScaleId>; export interface RadialAreaOptions extends RadialPathOptions { radius1?: number | Channel; curve?: CurveFactory; fill?: VisualChannel; fillOpacity?: number; stroke?: VisualChannel; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; opacity?: number; } export declare function radialArea(source: Iterable): PolarMark; export declare function radialArea> | undefined>(source: Iterable, options: TOptions): PolarMark, OptionChannelOutput, OptionScaleId, OptionScaleId>; export interface RadialDotOptions extends RadialPathOptions { r?: number | Channel; rScale?: ChartNumericScale; fill?: VisualChannel; fillOpacity?: number; stroke?: string; strokeOpacity?: number; strokeWidth?: number; opacity?: number; } export interface RadialTextOptions extends RadialPathOptions { text?: Channel; fill?: VisualChannel; fontSize?: number; fontWeight?: number; anchor?: VisualChannel; baseline?: VisualChannel; rotate?: VisualChannel; /** Signed pixel offset applied after the semantic radius is mapped. */ radiusOffset?: VisualChannel; dx?: VisualChannel; dy?: VisualChannel; } export declare function radialText(source: Iterable): PolarMark; export declare function radialText> | undefined>(source: Iterable, options: TOptions): PolarMark, OptionChannelOutput, OptionScaleId, OptionScaleId>; export interface RadialRuleOptions extends ChartMarkMotionOptions { id?: string; className?: string; /** Named angle scale. Omit to use the reserved `angle` scale. */ angleScale?: string; /** Named radius scale. Omit to use the reserved `radius` scale. */ radiusScale?: string; angle?: number | Channel; radius1?: number | Channel; radius2?: number | Channel; /** Signed pixel offset applied after radius1 is mapped. */ radius1Offset?: VisualChannel; /** Signed pixel offset applied after radius2 is mapped. */ radius2Offset?: VisualChannel; key?: Channel; z?: Channel; color?: Channel; stroke?: VisualChannel; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; opacity?: number; } export declare function radialRule(source: Iterable): PolarMark; export declare function radialRule> | undefined>(source: Iterable, options: TOptions): PolarMark, number, OptionScaleId, OptionScaleId>; export declare function radialDot(source: Iterable): PolarMark; export declare function radialDot> | undefined>(source: Iterable, options: TOptions): PolarMark, OptionChannelOutput, OptionScaleId, OptionScaleId>; export interface PolarGuideLabelContext { value: ChartValue; index: number; angle: number; radius: number; x: number; y: number; layout: PolarLayoutContext; } export type PolarGuideLabelOption = TValue | ((context: PolarGuideLabelContext) => TValue); interface PolarGuideStyle { id?: string; className?: string; labelClassName?: string; stroke?: string; strokeOpacity?: number; strokeWidth?: number; strokeDasharray?: string; fill?: string; fillOpacity?: number; labels?: boolean; labelFill?: string; labelFontSize?: number; labelAnchor?: PolarGuideLabelOption<'start' | 'middle' | 'end'>; labelBaseline?: PolarGuideLabelOption<'auto' | 'middle' | 'hanging'>; labelDx?: PolarGuideLabelOption; labelDy?: PolarGuideLabelOption; labelRotate?: PolarGuideLabelOption; } export interface RadialGridOptions extends PolarGuideStyle { /** Named radius scale. Omit to use the reserved `radius` scale. */ scale?: string; /** Angle scale used for polygon rings. Omit to use reserved `angle`. */ angleScale?: string; values?: readonly ChartValue[]; ticks?: number; shape?: 'circle' | 'polygon'; format?: (value: ChartValue) => string; labelAngle?: number; labelOffset?: number; } export declare function radialGrid(options?: RadialGridOptions): PolarGuide; export interface AngleGridOptions extends PolarGuideStyle { /** Named angle scale. Omit to use the reserved `angle` scale. */ scale?: string; values?: readonly ChartValue[]; format?: (value: ChartValue) => string; labelOffset?: number; } export declare function angleGrid(options?: AngleGridOptions): PolarGuide;