import type { ScaleLinear, ScaleTime } from 'd3-scale'; import type { ChartAxis } from '../../Chart/models'; interface DsData { ds_color_area: string; ds_color_line: string; ds_filled: boolean; ds_invert: string | null; ds_legend: string | null; ds_order: string | null; ds_stack: string | boolean | null; ds_stack_key?: string | null; ds_transparency: number; } export interface Metric { average_value: number | null; crit: number | null; critical_high_threshold: number | null; critical_low_threshold: number | null; data: Array; displayAs?: 'line' | 'bar'; ds_data: DsData; legend: string; maximum_value: number | null; metric: string; metric_id: number; minimum_value: number | null; unit: string; warning_high_threshold: number | null; warning_low_threshold: number | null; service_name: string | null; host_name: string | null; } type TimeSeries = { timeTick: string }; export type TimeValue = TimeSeries & { [field: number]: number; }; export interface Line { areaColor: string; average_value: number | null; color: string; display: boolean; displayAs?: 'line' | 'bar'; filled: boolean; highlight?: boolean; invert: string | null; legend: string | null; lineColor: string; maximum_value: number | null; metric: string; metric_id: number; minimum_value: number | null; name: string; stackOrder: number | null; stackKey: string | null; transparency: number; unit: string; } export enum GraphOptionId { displayEvents = 'displayEvents', displayTooltips = 'displayTooltips' } export interface AdditionalDataProps { additionalData?: T | null; } export interface Xscale { dataTime: Array; valueWidth: number; } export interface AxeScale extends Pick { dataLines: Array; dataTimeSeries: Array; isHorizontal?: boolean; thresholdUnit?: string; thresholds: Array; valueGraphHeight: number; } export interface GetYScaleProps { hasMoreThanTwoUnits: boolean; invert: string | null; leftScale: ScaleLinear; rightScale: ScaleLinear; secondUnit: string; unit: string; } export interface LinesProps { getSortedStackedLines: (lines: Array) => Array; getTime: (timeValue: TimeValue) => number; getUnits: (lines: Array) => Array; getYScale: ({ hasMoreThanTwoUnits, unit, secondUnit, leftScale, rightScale, invert }: GetYScaleProps) => ScaleLinear; graphHeight: number; graphWidth: number; leftScale: ScaleLinear; lines: Array; rightScale: ScaleLinear; timeSeries: Array; xScale: ScaleTime; } export interface NewLines { newLines: Array; newSortedLines: Array; } export interface FormatMetricValueProps { base?: number; unit: string; value: number | null; } export interface YScales { leftScale: ScaleLinear; rightScale: ScaleLinear; } export interface TimeValueProps { marginLeft?: number; timeSeries: Array; x?: number; xScale: ScaleTime | ScaleLinear; }