import { AgAxisLabelFormatterParams, AgChartOptions, Formatter } from 'ag-charts-enterprise'; import { ColDef } from 'ag-grid-community'; import { OptionWithFormatterAndDataType } from './types'; export declare const isAvailableSecondarySeriesColDef: (colDef: ColDef) => boolean; export declare const getSecondarySeriesKey: (field: string, aggFunc: string | null | undefined, rowGroupFields: Set) => string; /** * Rounds `rawMax` up to a "nice" ceiling that divides into `intervals` equal, * human-friendly steps (multiples of 1, 2, 2.5, or 5 × a power of ten). * * Used to give the primary and secondary y-axes the same number of intervals * from a shared zero baseline, so their gridlines coincide as one set of * horizontal lines instead of two misaligned sets. e.g. a raw max of 9.3 over * 5 intervals rounds to 10 (steps of 2); a raw max of 100 stays 100 (steps of 20). * * Returns 0 for non-positive or non-finite input, signalling the caller to fall * back to AG Charts' automatic scaling rather than building a degenerate axis. */ export declare const niceAxisCeiling: (rawMax: number, intervals: number) => number; /** * A "nice" fitted axis window: floor and ceiling on multiples of a nice step * (1 / 2 / 2.5 / 5 x 10^k) spanning exactly `intervals` equal steps, with * floor <= rawMin and ceiling >= rawMax. * * Used for a line chart's primary value axis when it is grid-aligned against a * secondary axis: lines don't encode value by length from a baseline, so the * axis can hug the data (e.g. percentages clustered around 100%) instead of * stretching to zero — and because the window keeps the shared interval count, * both axes' gridlines still coincide. Data near zero floors to zero naturally. * * Returns null for non-finite, negative-min, or degenerate (max <= min) input, * signalling the caller to fall back to the zero-based window. */ export declare const niceAxisRange: (rawMin: number, rawMax: number, intervals: number) => { min: number; max: number; step: number; } | null; export declare const computeNoDataOverlayText: ({ currentRowGroupColumnsLength, shouldShowFocusOverlayText, chartDataEmpty, missingFocusText, yAxisName, yAxisOptionCount, }: { currentRowGroupColumnsLength: number; shouldShowFocusOverlayText: boolean; chartDataEmpty: boolean; missingFocusText: string | undefined | null; /** Display name of the currently selected y-axis. */ yAxisName?: string; /** * Number of selectable y-axis options. Prompting the user to "select a different one" * only makes sense when there's more than one to choose from. */ yAxisOptionCount?: number; }) => string; /** * True when a column represents a point in time. A date column on the x-axis is * always plotted chronologically (see `sortChartDataChronologically`) - ordering * dates by their series value would make the chart unreadable. */ export declare const isChronologicalColDef: (colDef: ColDef | null | undefined) => boolean; /** * Orders chart data oldest to newest by its category (x-axis) field. Used when the * x-axis column has the `date` data type, where chronological order is the only * meaningful order regardless of the user's chart sort selection. * * Values that can't be parsed as dates sink to the end (ordered by their raw string * value) so an unexpected category never displaces the real timeline. */ export declare const sortChartDataChronologically: (data: AgChartOptions["data"], categoryField: string) => AgChartOptions["data"]; export declare const generateStackSeriesKey: (seriesField: string, stackField: string) => string; export declare const generateStackSecondaryCategoryKey: (stackField: string) => string; export interface StackValuesPage { data: AgChartOptions["data"]; /** Total distinct stack values across all pages. */ total: number; pageCount: number; /** The page actually returned — clamped into range if the requested one was out of bounds. */ pageIndex: number; /** This page's stack values, ordered by total contribution to the primary series, * descending (highest cost first) — the render order, not just the selection. */ orderedLabels: string[]; } /** * Same idea as paginateStackValuesByTotal, but for the client-side grouping path: rows are * already pivoted one-per-category (each stack value lives in its own `field_stackValue` * sub-key via generateStackSeriesKey — see getStackedChartDataFromRowNodes), rather than one * row per raw record. Ranks stack values by total contribution to the primary series across * all category rows, keeps only the requested page, and recomputes each series' `_sort_total` * to reflect only the kept values (so axis scaling and label-suppression thresholds match what * actually renders — otherwise they'd stay based on every value, page or no page). * * Ranking (and the `_sort_total` recompute) only happens when paging is actually enabled (a * positive `pageSize`) — see paginateStackValuesByTotal for why that matters. With `pageSize` * falsy (paging off, the default), `fieldValues` and each row's existing sort totals pass * through unchanged. */ export declare const paginatePivotedStackValuesByTotal: (rows: AgChartOptions["data"], fieldValues: string[], seriesColumns: OptionWithFormatterAndDataType[], primaryField: string | undefined, pageSize: number | undefined, pageIndex: number) => StackValuesPage; export declare const buildStackedChartData: (data: AgChartOptions["data"], categoryField: string, stackField: string, seriesColumns: OptionWithFormatterAndDataType[], supplementaryChartingColumns?: OptionWithFormatterAndDataType[], primarySeriesField?: string, stackValuesPageSize?: number, stackValuesPageIndex?: number) => { data: never[]; uniqueFieldValues: never[]; totalStackValueCount: number; stackValuesPageCount: number; stackValuesPageIndex: number; stackedData?: undefined; } | { stackedData: any[]; uniqueFieldValues: string[]; totalStackValueCount: number; stackValuesPageCount: number; stackValuesPageIndex: number; data?: undefined; }; /** * A lone bar in a category ("bar"-type) chart would otherwise stretch full-width. * Flank the single row with two sentinel blank categories so it renders at a * natural width instead. * * The sentinels are dedicated values that can never equal a real category. This * matters when the single real category is itself blank (a "(Blanks)" group, * whose key is ""): a naive "" pad would collide with the real category, and the * pad's transparent, valueless bar would overwrite the real one - rendering it * invisible. Both sentinels are hidden by the category-axis label formatter and * filtered out of map/scatter data. */ export declare const padSingleCategoryBarData: (data: AgChartOptions["data"], categoryField: string) => AgChartOptions["data"]; export declare const calculateMaxChartSeriesValue: (data: any[] | undefined, seriesField: string, isStacked: boolean) => number; export declare const calculateMinChartSeriesValue: (data: any[] | undefined, seriesField: string, isStacked: boolean) => number; /** * Builds the category axis's label formatter. Exactly one of three behaviors applies: * - `hideLabel`: every label is blank (e.g. a chart type that doesn't show x-axis labels). * - `showDistributionRangeLabels`: only the two blank pad categories flanking a histogram's * real buckets are labeled, with the overall lowest min / highest max bucket boundary; * every other category (including the real buckets themselves) is blank. * - Otherwise: normal category labels, formatted via `columnValueFormatter`, with the * separator/single-bar-padding sentinel categories hidden, a focus suffix appended, and * the result truncated to `MAX_LABEL_LENGTH`. */ export declare const buildCategoryAxisLabelFormatter: ({ hideLabel, showDistributionRangeLabels, chartData, formatBucketBoundary, columnValueFormatter, enableFocusView, focuses, focusText, }: { hideLabel: boolean; showDistributionRangeLabels: boolean; chartData: AgChartOptions["data"]; formatBucketBoundary: (value: number) => string; columnValueFormatter: Formatter | undefined; enableFocusView: boolean; focuses: string[]; focusText: string; }) => ((params: AgAxisLabelFormatterParams) => string);