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 { ChartUnit } from '../../core/types/chart-unit.js'; import type { ColorPalette } 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'; /** * 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; /** * Show/hide label on honeycomb nodes. * * @defaultValue 'false' */ showLabels?: boolean; } /** * HoneycombCharts props when using a categorical dataset * @public */ 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; }; } /** * HoneycombCharts props when using a numeric dataset * @public */ 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; } /** * The Honeycomb component props * @public */ export type HoneycombChartProps = HoneycombCategoricalProps | HoneycombChartNumericalProps; /** * @internal */ export type HoneycombData = string | number | string[] | HoneycombTileCategoricalData[] | number[] | HoneycombTileNumericData[]; /*** * @internal */ export type HoneycombDatasetType = 'numeric' | 'categorical';