import type { ReactNode } from 'react'; import type { TruncationMode } from '@dynatrace/strato-components/typography'; import type { ConvertibleUnit, FormatOptions, Unit } from '@dynatrace-sdk/units'; import type { LabelsDisplay, NameAccessor, ValueAccessor } from './treemap.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 { LegendProps } from '../../core/types/legend.js'; import type { ChartToolbarConfig } from '../../core/types/toolbar.js'; /** * @public */ export interface TreeMapContextConfig { /** * Color palette to use for coloring the tree nodes. Nodes of height 1 * get a color assigned from the palette. If the are more nodes than * colors, they are repeated. Nodes of height 2 get different shades * of their parents color assigned. The shading depends on the nodes * size compared to the biggest node. * * @defaultValue 'categorical' */ colorPalette?: ColorPalette | CustomColorPalette | ColoredRange[]; /** * Custom value formatter for the chart. */ formatter?: Formatter | FormatOptions; /** * The text truncation mode used for the chart legend. * * @defaultValue 'middle' */ truncationMode?: TruncationMode; /** * Show the loading indicator. * * @defaultValue false */ loading?: boolean; /** * Show/hide label on TreeMap clusters and/or nodes */ labelsDisplay?: LabelsDisplay; /** * Legend configuration for the treemap chart */ legend?: TreemapChartLegendConfig; /** * Toolbar configuration for the treemap chart */ toolbar?: TreeMapChartToolbarConfig; /** * Data accessor on leaf nodes by which legend can be defined * @deprecated - Will be removed, use `nameAccessor` instead. */ valueAccessor?: ValueAccessor; /** * Data accessor on leaf nodes by which legend can be defined */ nameAccessor?: NameAccessor; /** The min value configuration to display */ min?: 'data-min' | number; /** The max value configuration to display */ max?: 'data-max' | number; } /** * @internal */ export type FilteredTreeMapContextConfig = Omit; /** * @internal */ export type TreeMapConfig = Required & { toolbar?: TreeMapChartToolbarConfig; nameAccessor?: NameAccessor; min?: 'data-min' | number; max?: 'data-max' | number; }; /** * @public */ export type TreemapChartLegendConfig = LegendProps; /** * @internal */ export interface TreeMapChartSlots { legend: Partial; tooltip: Partial; toolbar: Partial | undefined; emptyState?: ReactNode; errorState?: ReactNode; } /** * @public */ export type TreeMapChartToolbarConfig = ChartToolbarConfig;