import type { AgCartesianSeriesOptions } from '../series/cartesian/cartesianSeriesTypes'; import type { AgAnnotationsOptions } from './annotationsOptions'; import type { AgAxisBaseIntervalOptions, AgAxisBaseTickOptions, AgAxisCaptionOptions, AgAxisContinuousIntervalOptions, AgAxisLabelStylerParams, AgBaseAxisLabelOptions, AgBaseAxisLabelStyleOptions, AgBaseAxisOptions, AgBaseContinuousAxisOptions, AgContinuousAxisOptions, AgNumericAxisFormattableLabelOptions, AgTimeAxisFormattableLabelFormat, AgTimeAxisFormattableLabelOptions, AgTimeInterval, AgTimeIntervalUnit } from './axisOptions'; import type { AgBandHighlightOptions } from './bandHighlightOptions'; import type { Styler } from './callbackOptions'; import type { AgBaseThemeableChartOptions } from './chartOptions'; import type { AgBaseCrossLineLabelOptions, AgBaseCrossLineOptions, AgCrossLineLabelPosition, AgCrossLineThemeOptions } from './crossLineOptions'; import type { AgBaseCrosshairLabel, AgCrosshairLabel, AgCrosshairOptions } from './crosshairOptions'; import type { ContextDefault, DatumDefault, Degree, PixelSize, Ratio, TextWrap } from './types'; /** Configuration for axes in cartesian charts. */ export interface AgBaseCartesianAxisOptions, CrosshairLabelType = AgCrosshairLabel, TContext = ContextDefault> extends AgBaseAxisOptions { /** The position on the chart where the axis should be rendered. */ position?: AgCartesianAxisPosition; /** Value on the first perpendicular axis' domain where this axis should intersect. */ crossAt?: AgCartesianAxisCrossAt; /** Add cross-lines or regions corresponding to data values. */ crossLines?: AgCartesianCrossLineOptions[]; /** Sets the axis thickness regardless of its content. */ thickness?: PixelSize; /** * The maximum thickness of the axis, as a ratio of the chart's width or height depending on axis direction. * Used to prevent the axis from growing too large when labels or content are oversized. * * Default: `0.3` */ maxThicknessRatio?: Ratio; /** Configuration for the title shown next to the axis. */ title?: AgAxisCaptionOptions; /** Configuration for the axis crosshair. */ crosshair?: AgCrosshairOptions; } export interface AgCartesianAxisCrossAt { /** The value on the perpendicular axis' domain where this axis should intersect. */ value: number | Date | string | string[]; /** * Whether the axis should remain visible when the cross position is outside the perpendicular axis domain. * * Default: `true` */ sticky?: boolean; } export interface AgTimeAxisParentLevel { /** Enables parent level labels and ticks. */ enabled?: boolean; /** Configuration for the axis labels, shown next to the ticks. */ label?: AgCartesianTimeAxisLabelOptions; /** Configuration for the axis ticks. */ tick?: AgAxisBaseTickOptions; } export interface AgCartesianAxisLabelOptions extends AgBaseCartesianAxisLabelOptions, AgNumericAxisFormattableLabelOptions { } export interface AgCartesianTimeAxisLabelOptions extends AgBaseCartesianAxisLabelOptions, AgTimeAxisFormattableLabelOptions { } export interface AgBaseCartesianAxisLabelOptions extends AgBaseAxisLabelOptions { /** If specified and axis labels may collide, they are rotated so that they are positioned at the supplied angle. This is enabled by default for category. If the `rotation` property is specified, it takes precedence. */ autoRotate?: boolean; /** If autoRotate is enabled, specifies the rotation angle to use when autoRotate is activated. Defaults to an angle of 335 degrees if unspecified. */ autoRotateAngle?: Degree; /** * Text wrapping strategy for long text. * - `'always'` will always wrap text to fit within the `maxWidth`. * - `'hyphenate'` is similar to `'always'`, but inserts a hyphen (`-`) if forced to wrap in the middle of a word. * - `'on-space'` will only wrap on white space. If there is no possibility to wrap a line on space and satisfy the `maxWidth`, the text will be truncated. * - `'never'` disables text wrapping. * * Default: `'on-space'` */ wrapping?: TextWrap; /** * If truncate is enabled, the text will be truncated to fit available space and an ellipsis (`...`) will be added at the end of the text. */ truncate?: boolean; } export interface AgGroupedCategoryAxisLabelOptions extends Omit, 'itemStyler'> { /** * Text wrapping strategy for long text. * - `'always'` will always wrap text to fit within the `maxWidth`. * - `'hyphenate'` is similar to `'always'`, but inserts a hyphen (`-`) if forced to wrap in the middle of a word. * - `'on-space'` will only wrap on white space. If there is no possibility to wrap a line on space and satisfy the `maxWidth`, the text will be truncated. * - `'never'` disables text wrapping. * * Default: `'on-space'` */ wrapping?: TextWrap; /** * If truncate is enabled, the text will be truncated to fit available space and an ellipsis (`...`) will be added at the end of the text. */ truncate?: boolean; /** Function used to style axis labels. */ itemStyler?: Styler, AgBaseAxisLabelStyleOptions>; } export interface AgGroupedCategoryAxisLabelStylerParams extends AgAxisLabelStylerParams { /** The depth of the label, used by `grouped-category` axes. */ readonly depth: number; } export type AgCartesianAxesOptions = Record> & { x?: AgCartesianAxisOptions; y?: AgCartesianAxisOptions; }; export interface AgBaseCartesianChartOptions { /** Axis configurations. * * Axes are referenced using a dictionary of axis definitions, where each axis is identified by a key. * The default keys are `x` and `y` for cartesian axes, or `radius` and `angle` for polar axes. * * See: [Axis Configuration](/r/axes-configuration/) */ axes?: AgCartesianAxesOptions; /** Series configurations. */ series?: AgCartesianSeriesOptions[]; /** Annotations configurations. */ annotations?: AgAnnotationsOptions; } export interface AgGroupedCategoryDepthLabelOptions extends Pick, 'enabled' | 'avoidCollisions' | 'rotation' | 'spacing' | 'border' | 'color' | 'cornerRadius' | 'fill' | 'fontFamily' | 'fontSize' | 'fontStyle' | 'fontWeight' | 'padding'> { /** * Text wrapping strategy for long text. * - `'always'` will always wrap text to fit within the `maxWidth`. * - `'hyphenate'` is similar to `'always'`, but inserts a hyphen (`-`) if forced to wrap in the middle of a word. * - `'on-space'` will only wrap on white space. If there is no possibility to wrap a line on space and satisfy the `maxWidth`, the text will be truncated. * - `'never'` disables text wrapping. * * Default: `'on-space'` */ wrapping?: TextWrap; /** * If truncate is enabled, the text will be truncated to fit available space and an ellipsis (`...`) will be added at the end of the text. */ truncate?: boolean; } export type AgGroupedCategoryDepthTickOptions = Pick; export interface AgGroupedCategoryDepthOptions { /** Configuration for the axis labels at this depth level. */ label?: AgGroupedCategoryDepthLabelOptions; /** Configuration for the axis ticks at this depth level. */ tick?: AgGroupedCategoryDepthTickOptions; } type AgAxisIntervalPlacement = 'on' | 'between'; export interface AgAxisCategoryIntervalOptions extends AgAxisBaseIntervalOptions { /** * Placement of ticks and labels relative to the category. * * Default: `'between'` */ placement?: AgAxisIntervalPlacement; } export interface AgAxisDiscreteTimeIntervalOptions extends AgAxisContinuousIntervalOptions { /** * Placement of ticks and labels relative to the time interval. * * Default: `'between'` */ placement?: AgAxisIntervalPlacement; } export type AgBandAlignment = 'justify' | 'start' | 'center' | 'end'; export interface AgCategoryAxisOptions extends AgBaseCartesianAxisOptions, AgBaseCrosshairLabel, TContext> { type?: 'category'; /** Configuration for the axis ticks interval. */ interval?: AgAxisCategoryIntervalOptions; /** The size of the gap between the categories as a proportion, between 0 and 1. This value is a fraction of the “step”, which is the interval between the start of a band and the start of the next band. */ paddingInner?: Ratio; /** The padding on the outside i.e. left and right of the first and last category. In association with `paddingInner`, this value can be between 0 and 1. */ paddingOuter?: Ratio; /** This property is for grouped column/bar series plotted on a category axis. It is a proportion between 0 and 1 which determines the size of the gap between the bars or columns within a single group along the axis. */ groupPaddingInner?: Ratio; /** Configuration for the axis band highlight. */ bandHighlight?: AgBandHighlightOptions; /** * The alignment of bands when used with bar-like series with fixed widths. * * Default: `'justify'` */ bandAlignment?: AgBandAlignment; /** * Set to `true` to prevent bars with `null`, `undefined` or missing values from taking up space in each category. * * Default: `false` */ skipNullBars?: boolean; } type AgGroupedCategoryAxisTickOptions = Omit; export interface AgGroupedCategoryAxisOptions extends Omit, AgBaseCrosshairLabel, TContext>, 'tick'> { type?: 'grouped-category'; /** The size of the gap between the categories as a proportion, between 0 and 1. This value is a fraction of the “step”, which is the interval between the start of a band and the start of the next band. */ paddingInner?: Ratio; /** This property is for grouped column/bar series plotted on a category axis. It is a proportion between 0 and 1 which determines the size of the gap between the bars or columns within a single group along the axis. */ groupPaddingInner?: Ratio; /** An array of depth options, starting from the leafs. */ depthOptions?: AgGroupedCategoryDepthOptions[]; /** Configuration for the axis ticks. */ tick?: AgGroupedCategoryAxisTickOptions; /** Configuration for the axis band highlight. */ bandHighlight?: AgBandHighlightOptions; /** * The maximum thickness of the axis, as a ratio of the chart's width or height depending on axis direction. * Used to prevent the axis from growing too large when labels or content are oversized. * * Default: `0.5` */ maxThicknessRatio?: Ratio; } export interface AgTimeAxisOptions extends Omit, AgCrosshairLabel, TContext>, 'interval'>, AgContinuousAxisOptions { type?: 'time'; /** Options for labels and ticks for the parent level intervals. */ parentLevel?: AgTimeAxisParentLevel; } export interface AgUnitTimeAxisOptions extends Omit, AgCrosshairLabel, TContext>, 'interval'>, AgBaseContinuousAxisOptions { type?: 'unit-time'; /** Options for labels and ticks for the parent level intervals. */ parentLevel?: AgTimeAxisParentLevel; /** The size of each band. */ unit?: AgTimeInterval | AgTimeIntervalUnit; /** Configuration for the axis ticks interval. */ interval?: AgAxisDiscreteTimeIntervalOptions; /** The size of the gap between the categories as a proportion, between 0 and 1. This value is a fraction of the “step”, which is the interval between the start of a band and the start of the next band. */ paddingInner?: Ratio; /** The padding on the outside i.e. left and right of the first and last category. In association with `paddingInner`, this value can be between 0 and 1. */ paddingOuter?: Ratio; /** This property is for grouped column/bar series plotted on a category axis. It is a proportion between 0 and 1 which determines the size of the gap between the bars or columns within a single group along the axis. */ groupPaddingInner?: Ratio; /** Configuration for the axis band highlight. */ bandHighlight?: AgBandHighlightOptions; /** * The alignment of bands when used with bar-like series with fixed widths. * * Default: `'justify'` */ bandAlignment?: AgBandAlignment; /** * Set to `true` to prevent bars with `null`, `undefined` or missing values from taking up space in each category. * * Default: `false` */ skipNullBars?: boolean; } export interface AgOrdinalTimeAxisOptions extends AgBaseCartesianAxisOptions, AgCrosshairLabel, TContext> { type?: 'ordinal-time'; /** Options for labels and ticks for the parent level intervals. */ parentLevel?: AgTimeAxisParentLevel; /** Configuration for the axis ticks interval. */ interval?: AgAxisDiscreteTimeIntervalOptions; /** The size of the gap between the categories as a proportion, between 0 and 1. This value is a fraction of the “step”, which is the interval between the start of a band and the start of the next band. */ paddingInner?: Ratio; /** The padding on the outside i.e. left and right of the first and last category. In association with `paddingInner`, this value can be between 0 and 1. */ paddingOuter?: Ratio; /** This property is for grouped column/bar series plotted on a category axis. It is a proportion between 0 and 1 which determines the size of the gap between the bars or columns within a single group along the axis. */ groupPaddingInner?: Ratio; /** Configuration for the axis band highlight. */ bandHighlight?: AgBandHighlightOptions; /** * The alignment of bands when used with bar-like series with fixed widths. * * Default: `'justify'` */ bandAlignment?: AgBandAlignment; /** * Set to `true` to prevent bars with `null`, `undefined` or missing values from taking up space in each category. * * Default: `false` */ skipNullBars?: boolean; } export interface AgNumberAxisOptions extends Omit, AgCrosshairLabel, TContext>, 'interval'>, AgContinuousAxisOptions { type?: 'number'; } export interface AgLogAxisOptions extends Omit, AgCrosshairLabel, TContext>, 'interval'>, AgContinuousAxisOptions { type?: 'log'; /** The base of the logarithm used. */ base?: number; } export type AgCartesianAxisPosition = 'top' | 'right' | 'bottom' | 'left'; export type AgCartesianAxisOptions = AgNumberAxisOptions | AgLogAxisOptions | AgCategoryAxisOptions | AgOrdinalTimeAxisOptions | AgTimeAxisOptions | AgUnitTimeAxisOptions | AgGroupedCategoryAxisOptions; export type AgCartesianAxisType = NonNullable['type']>; /** This is the configuration shared by all types of axis. */ export interface AgCartesianAxisThemeOptions { /** An object with axis theme overrides for the `top` positioned axes. Same configs apply here as one level above. For example, to rotate labels by 45 degrees in 'top' positioned axes one can use `top: { label: { rotation: 45 } } }`. */ top?: Omit; /** An object with axis theme overrides for the `right` positioned axes. Same configs apply here as one level above. */ right?: Omit; /** An object with axis theme overrides for the `bottom` positioned axes. Same configs apply here as one level above. */ bottom?: Omit; /** An object with axis theme overrides for the `left` positioned axes. Same configs apply here as one level above. */ left?: Omit; } export interface AgBaseCartesianThemeOptions extends AgBaseThemeableChartOptions { /** Axis configurations. */ axes?: AgCartesianAxesTheme; } export interface AgCartesianAxesCrossLineThemeOptions { /** Theme configuration for Cross Lines. */ crossLines?: AgCrossLineThemeOptions; } export interface AgCartesianAxesTheme { /** This extends the common axis configuration with options specific to number axes. */ number?: AgNumberAxisThemeOptions; /** This extends the common axis configuration with options specific to number axes. */ log?: AgLogAxisThemeOptions; /** This extends the common axis configuration with options specific to category axes. */ category?: AgCategoryAxisThemeOptions; /** This extends the common axis configuration with options specific to time axes. */ time?: AgContinuousTimeAxisThemeOptions; /** This extends the common axis configuration with options specific to ordinal-time axes. */ 'ordinal-time'?: AgOrdinalTimeAxisThemeOptions; /** This extends the common axis configuration with options specific to grouped-category axes. */ 'grouped-category'?: AgGroupedCategoryAxisThemeOptions; /** This extends the common axis configuration with options specific to unit-time axes. */ 'unit-time'?: AgUnitTimeAxisThemeOptions; } export type AgContinuousCartesianAxesTheme = Pick, 'number' | 'log' | 'time'>; type ThemeOmittedAxisOptions = 'type' | 'crossLines'; export interface AgNumberAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgLogAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgCategoryAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgOrdinalTimeAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgGroupedCategoryAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgContinuousTimeAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgUnitTimeAxisThemeOptions extends Omit, ThemeOmittedAxisOptions>, AgCartesianAxisThemeOptions>, AgCartesianAxesCrossLineThemeOptions { } export interface AgCartesianCrossLineOptions extends AgBaseCrossLineOptions { } export interface AgCartesianCrossLineLabelOptions extends AgBaseCrossLineLabelOptions { /** The position of the Cross Line label. */ position?: AgCrossLineLabelPosition; /** The rotation of the Cross Line label in degrees. */ rotation?: Degree; } export {};