import type { ContextCallbackParams, DatumCallbackParams, HighlightState, Styler } from '../../chart/callbackOptions'; import type { AgDropShadowOptions } from '../../chart/dropShadowOptions'; import type { AgChartLabelOptions } from '../../chart/labelOptions'; import type { AgSeriesTooltip, AgSeriesTooltipRendererParams } from '../../chart/tooltipOptions'; import type { ContextDefault, CssColor, DatumDefault, DatumKey, Degree, Opacity, PixelSize, Ratio } from '../../chart/types'; import type { AgColorType, FillOptions, LineDashOptions, StrokeOptions, TextOptions, Toggleable } from '../cartesian/commonOptions'; import type { AgBaseSeriesOptions, AgBaseSeriesThemeableOptions, AgHighlightStyleOptions, AgMultiSeriesHighlightOptions } from '../seriesOptions'; export interface AgPieSeriesLabelOptions extends AgChartLabelOptions { /** Distance in pixels between the callout line and the label text. */ offset?: PixelSize; /** Minimum angle in degrees required for a sector to show a label. */ minAngle?: Degree; /** Avoid callout label collision and overflow by automatically moving colliding labels or reducing the pie radius. If set to `false`, callout labels may collide with each other and the pie radius will not change to prevent clipping of callout labels. */ avoidCollisions?: boolean; } export interface AgPieSeriesSectorLabelOptions extends AgChartLabelOptions { /** Distance in pixels, used to make the label text closer to or further from the center. This offset is applied after positionRatio. */ positionOffset?: PixelSize; /** Position of labels as a ratio proportional to pie radius. Additional offset in pixels can be applied by using positionOffset. */ positionRatio?: Ratio; } export type AgPieSeriesItemStylerParams = DatumCallbackParams & ContextCallbackParams & AgPieSeriesOptionsKeys & Required; export interface AgPieSeriesStyle extends FillOptions, StrokeOptions, LineDashOptions { /** Apply rounded corners to each sector. */ cornerRadius?: PixelSize; } export interface AgPieTitleOptions extends Toggleable, TextOptions { /** The text to display. */ text?: string; /** Spacing added to help position the text. */ spacing?: PixelSize; /** Whether the title text should be shown in the legend. */ showInLegend?: boolean; } export interface AgPieCalloutLineItemStylerParams extends DatumCallbackParams, ContextCallbackParams, AgPieSeriesLabelFormatterParams { } export interface AgPieCalloutLineItemStylerResult { /** The colour for this callout line. */ color?: CssColor; /** The length in pixels of the callout lines. */ length?: PixelSize; /** The width in pixels of the stroke for callout lines. */ strokeWidth?: PixelSize; } export interface AgPieSeriesCalloutOptions { /** The colours to cycle through for the strokes of the callouts. */ colors?: CssColor[]; /** The length in pixels of the callout lines. */ length?: PixelSize; /** The width in pixels of the stroke for callout lines. */ strokeWidth?: PixelSize; /** Function used to style individual callout lines. */ itemStyler?: Styler, AgPieCalloutLineItemStylerResult>; } export interface AgPieSeriesThemeableOptions extends AgBaseSeriesThemeableOptions, LineDashOptions { /** Configuration for the series title. */ title?: AgPieTitleOptions; /** Configuration for the labels used outside the sectors. */ calloutLabel?: AgPieSeriesLabelOptions, TContext>; /** Configuration for the labels used inside the sectors. */ sectorLabel?: AgPieSeriesSectorLabelOptions, TContext>; /** Configuration for the callout lines used with the labels for the sectors. */ calloutLine?: AgPieSeriesCalloutOptions; /** The colours to cycle through for the fills of the sectors. */ fills?: AgColorType[]; /** The colours to cycle through for the strokes of the sectors. */ strokes?: CssColor[]; /** The opacity of the fill for the sectors. */ fillOpacity?: Opacity; /** The opacity of the stroke for the sectors. */ strokeOpacity?: Opacity; /** The width in pixels of the stroke for the sectors. */ strokeWidth?: PixelSize; /** The rotation of the pie series in degrees. */ rotation?: Degree; /** The offset in pixels of the outer radius of the series. */ outerRadiusOffset?: PixelSize; /** The ratio of the outer radius of the series. Used to adjust the outer radius proportionally to the automatically calculated value. */ outerRadiusRatio?: Ratio; /** Override of the automatically determined minimum radiusKey value from the data. */ radiusMin?: number; /** Override of the automatically determined maximum radiusKey value from the data. */ radiusMax?: number; /** Configuration for the shadow used behind the chart series. */ shadow?: AgDropShadowOptions; /** Series-specific tooltip configuration. */ tooltip?: AgSeriesTooltip>; /** Apply rounded corners to each sector. */ cornerRadius?: PixelSize; /** The spacing between Pie sectors. */ sectorSpacing?: PixelSize; /** Whether items with a value of 0 should be hidden in the legend. */ hideZeroValueSectorsInLegend?: boolean; /** A styler function for adjusting the styling of the pie sectors. */ itemStyler?: Styler, AgPieSeriesStyle>; /** Configuration for highlighting when a series or legend item is hovered over. */ highlight?: AgMultiSeriesHighlightOptions; } export interface AgPieSeriesOptions extends Omit, 'innerLabels'>, AgPieSeriesOptionsKeys, AgPieSeriesOptionsNames, Omit, 'highlight' | 'selection'> { /** Configuration for Pie Series. */ type: 'pie'; } export interface AgPieSeriesOptionsKeys { /** The key to use to retrieve angle values from the data. */ angleKey: DatumKey; /** The key to use to retrieve radius values from the data. */ radiusKey?: DatumKey; /** The key to use to retrieve label values from the data. */ calloutLabelKey?: DatumKey; /** The key to use to retrieve sector label values from the data. */ sectorLabelKey?: DatumKey; /** The key to use to retrieve legend item labels from the data. If multiple pie series share this key they will be merged in the legend. */ legendItemKey?: DatumKey; } export interface AgPieSeriesOptionsNames { /** A human-readable description of the angle values. If supplied, this will be passed to the tooltip renderer as one of the parameters. */ angleName?: string; /** A human-readable description of the radius values. If supplied, this will be passed to the tooltip renderer as one of the parameters. */ radiusName?: string; /** A human-readable description of the label values. If supplied, this will be passed to the tooltip renderer as one of the parameters. */ calloutLabelName?: string; /** A human-readable description of the sector label values. If supplied, this will be passed to the tooltip renderer as one of the parameters. */ sectorLabelName?: string; } export interface AgPieSeriesTooltipRendererParams extends AgSeriesTooltipRendererParams, AgPieSeriesOptionsKeys, AgPieSeriesOptionsNames, FillOptions, StrokeOptions, LineDashOptions { } export type AgPieSeriesLabelFormatterParams = AgPieSeriesOptionsKeys & AgPieSeriesOptionsNames;