import type { ConvertibleUnit, FormatOptions, Unit } from '@dynatrace-sdk/units'; import type { BehaviorTrackingProps } from '../../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../../core/types/data-props.js'; import type { MaskingProps } from '../../../core/types/masking-props.js'; import type { StylingProps } from '../../../core/types/styling-props.js'; import type { TruncationMode } from '../../../typography/text-ellipsis/TextEllipsis.js'; import type { ChartData } from '../../core/types/chart-data.js'; import type { ChartUnit } from '../../core/types/chart-unit.js'; import type { ColorPalette, CustomColorPalette } from '../../core/types/color-palette.js'; import type { ColoredRange } from '../../core/types/colored-range.js'; import type { Formatter } from '../../core/types/formatter.js'; import type { SeriesActionsTemplate } from '../../core/types/series-actions-template.js'; /** * The Honeycomb chart ref * @public */ export interface HoneycombChartRef { /** The honeycomb chart root element */ readonly element: HTMLDivElement | null; /** Downloads honeycomb chart raw data .*/ downloadData: () => void; /** Returns the current serialized config of the HoneycombChart.*/ getConfig: () => string; } /** * Available tile shapes for the honeycomb * @public */ export type HoneycombTileShape = 'circle' | 'square' | 'hexagon'; /** * Controls which label content is shown inside each honeycomb tile. * * - `'all'` – show both name and value (space permitting) * - `'name'` – show the tile name only * - `'value'` – show the tile value only * - `'none'` – show no labels * * @defaultValue 'none' * @public */ export type HoneycombLabelsDisplay = 'all' | 'none' | 'name' | 'value'; /** * Information hold by each tile in the honeycomb * @public */ export type HoneycombTileData = HoneycombTileNumericData | HoneycombTileCategoricalData; /** * @public */ export type HoneycombTileBaseData = { [key: string]: unknown; name?: string; }; /** * @public */ export type HoneycombTileNumericData = HoneycombTileBaseData & { value: number; }; /** * @public */ export type HoneycombTileCategoricalData = HoneycombTileBaseData & { value: string; }; /** * @public */ export interface HoneycombBaseProps extends MaskingProps, StylingProps, DataTestId, BehaviorTrackingProps { /** * The shape of the honeycomb tiles. * @defaultValue 'hexagon' */ shape?: HoneycombTileShape; /** * The width of the chart. If a number is passed, it will be treated as px. * @defaultValue 100% */ width?: number | string; /** * The height of the chart. If a number is passed, it will be treated as px. * @defaultValue 300px */ height?: number | string; /** Show the loading indicator when set to true. * @defaultValue false */ loading?: boolean; /** Callback to display series actions for a tile */ seriesActions?: (tile: HoneycombTileData) => SeriesActionsTemplate; /** * Custom formatter for honeycomb's tiles values */ formatter?: Formatter | FormatOptions; /** * The custom unit for honeycomb's tiles values. */ unit?: ChartUnit; /** * The truncation mode to be used as start, middle or end in the long legend * labels * @defaultValue 'middle' */ truncationMode?: TruncationMode; /** * Controls which label content is shown inside each honeycomb tile. * Takes precedence over `showLabels` when both are provided. * * @defaultValue 'none' */ labelsDisplay?: HoneycombLabelsDisplay; /** * Show/hide label on honeycomb nodes. * * @defaultValue false * @deprecated Use `labelsDisplay` instead. Will be removed in a future major release. */ showLabels?: boolean; /** * Font size (in pixels) for tile labels, or `'auto'` to pick a size * per tile based on its height — larger tiles get larger text. * * @defaultValue 16 */ textSize?: number | 'auto'; } /** * HoneycombCharts props when using a categorical dataset. * @public * @deprecated Use the unified `ChartData` format with `valueAccessor` instead * (see {@link HoneycombChartAccessorDataProps}). This type will be removed in a * future release. */ export interface HoneycombCategoricalProps extends HoneycombBaseProps { /** Honeycomb categorical data */ data: string | string[] | HoneycombTileCategoricalData[]; /** Color Scheme to be applied to the categorical data */ colorScheme?: ColorPalette | { [key: string]: string; }; /** @internal */ colorPalette?: never; /** @internal */ valueAccessor?: never; } /** * HoneycombCharts props when using a numeric dataset. * @public * @deprecated Use the unified `ChartData` format with `valueAccessor` instead * (see {@link HoneycombChartAccessorDataProps}). This type will be removed in a * future release. */ export interface HoneycombChartNumericalProps extends HoneycombBaseProps { /** Honeycomb numerical data */ data: number | number[] | HoneycombTileNumericData[]; /** Color Scheme to be applied to the numerical data */ colorScheme?: ColorPalette | ColoredRange[]; /** The min value configuration to display */ min?: 'data-min' | number; /** The max value configuration to display */ max?: 'data-max' | number; /** @internal */ colorPalette?: never; /** @internal */ valueAccessor?: never; } /** * HoneycombChart props using the unified `ChartData` format. Each datapoint * represents a tile; the value field is resolved through `valueAccessor` * (dot-notation supported, e.g. `"metrics.value"`). * @public */ export interface HoneycombChartAccessorDataProps extends HoneycombBaseProps { /** Honeycomb data in the unified `ChartData` format. */ data: ChartData; /** * Accessor describing the field that holds the tile value. * @defaultValue 'value' */ valueAccessor?: string; /** Color palette to apply to the chart. */ colorPalette?: ColorPalette | CustomColorPalette; /** The min value configuration to display */ min?: 'data-min' | number; /** The max value configuration to display */ max?: 'data-max' | number; /** @internal */ colorScheme?: never; } /** * The Honeycomb component props * @public */ export type HoneycombChartProps = HoneycombCategoricalProps | HoneycombChartNumericalProps | HoneycombChartAccessorDataProps; /** * @internal */ export type HoneycombData = string | number | string[] | HoneycombTileCategoricalData[] | number[] | HoneycombTileNumericData[]; /*** * @internal */ export type HoneycombDatasetType = 'numeric' | 'categorical';