import { ECharts, EChartsOption } from 'echarts'; /** * Render-time clamp that stops the first/last **category x-axis** labels from * clipping at the chart edges — *only when they actually overflow*. * * ECharts centers each category label on its tick; the first/last ticks sit at * the plot boundary, so a wide edge label spills past the chart and is cut off. * `grid.containLabel` does not contain this horizontal overflow and the v6 * `outerBounds` shrink is unreliable, so we measure at render time and anchor * the overflowing edge label inward (`alignMinLabel: 'left'` / * `alignMaxLabel: 'right'`). Labels that fit stay centered. * * Lives in the generic bridge because the verdict needs the laid-out chart * (`convertToPixel`, `getWidth`); everything else is read from the `option`. * Auto-targets bar + histogram (category x-axis); pie's horizontal-bar fallback * (category *y*-axis), scatterplot (value) and timeseries (time) are skipped. */ export interface EdgeAlignment { alignMinLabel: 'left' | null; alignMaxLabel: 'right' | null; } export declare const CENTERED: EdgeAlignment; /** * Pure overflow decision. Inputs are anchor-independent (tick centers and text * width don't depend on the label's current `text-anchor`), so feeding the * result back via `setOption` doesn't change them — the next pass yields the * same verdict, keeping the clamp loop-stable. */ export declare function decideEdgeAlignment(args: { firstLabel: string; lastLabel: string; font: string; firstTickX: number; lastTickX: number; width: number; }): EdgeAlignment; /** * Extracts the displayed first/last category strings and the label font from * the option, reading categories generically via `series[0].encode.x` into the * referenced dataset (`'name'` for bar, `0` for histogram). Returns `null` when * the option isn't a measurable category x-axis (fewer than 2 categories, no * dataset, etc.). */ export declare function resolveEdgeLabels(option: EChartsOption): { firstLabel: string; lastLabel: string; font: string; count: number; } | null; /** * Measures the rendered chart and, when the edge labels would clip, applies * `alignMinLabel`/`alignMaxLabel` (or clears them) via an imperative merge * `setOption`. Returns the alignment now in effect so the caller can keep a * `prev` ref and skip redundant `setOption`s. Should be invoked from the * chart's `finished` event (layout is settled, so `convertToPixel` is valid). */ export declare function clampEdgeLabels(chart: ECharts, option: EChartsOption, prev: EdgeAlignment): EdgeAlignment;