import type { ReactNode } from 'react'; 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 { Formatter } from '../../core/types/formatter.js'; import type { SeriesActionsTemplate } from '../../core/types/series-actions-template.js'; /** * Props of the GaugeChart component * @public */ export interface GaugeChartBaseProps extends StylingProps, MaskingProps, DataTestId, BehaviorTrackingProps { /** * Min value for the meter bar chart scale. * @defaultValue 0 */ min?: number; /** * Max value for the meter bar chart scale. * @defaultValue 100 */ max?: number; /** * Color of the meter bar segment. If not provided, it will display a default color. * @defaultValue 'Colors.Charts.Categorical.Color11.Default' */ color?: string; /** * Custom Formatter for the chart */ formatter?: Formatter | FormatOptions; /** * The chart width. A valid CSS width is expected. * @defaultValue 100% */ width?: number | string; /** * The chart height. A valid CSS height is expected. * @defaultValue 300px */ height?: number | string; /** * Icon to show left of the value. */ prefixIcon?: ReactNode; /** * Exposed callback to display series actions for the gauge tooltip */ seriesActions?: (series: string | number | GaugeChartData) => SeriesActionsTemplate; /** * Unit to be displayed in the tooltip and the value label. */ unit?: string | Unit; /** Show the loading indicator when truthy. * @defaultValue false */ loading?: boolean; } /** * @public */ export interface GaugeChartData { [key: string]: unknown; } /** * @public */ export interface GaugeChartPropsWithAccessor extends GaugeChartBaseProps { /** * Data object to retrieve the value from using the valueAccessor. */ value: GaugeChartData; /** * Accessor string to retrieve the value from the data object. */ valueAccessor: string; } /** * @public */ export interface GaugeChartPropsWithNumericValue extends GaugeChartBaseProps { /** * Numeric value to be displayed by the Gauge Chart. */ value: number; valueAccessor?: never; } /** * @public */ export type GaugeChartProps = GaugeChartPropsWithAccessor | GaugeChartPropsWithNumericValue; /** * @public */ export interface GaugeChartRef { /** Chart div element */ readonly element: HTMLDivElement | null; /** Returns the current serialized config of the GaugeBarChart.*/ getConfig: () => string; }