import { ScaleBand, ScaleLinear } from 'd3-scale' export type ScaleLinearType = ScaleLinear; export type ScaleBandType = ScaleBand; export interface YAxisData { key: string; // string value for ChartLabel and useGraphData values: Array; // including this code only for review -- // do we prefer the idea of passing label formatting from the data or in the component? // generic function type, specific usage of value varies // eslint-disable-next-line no-unused-vars formatLabel?: (value: number) => string; } export type XValue = string | number export interface GraphData { xValues: Array; yValues: Array; } export interface YAxisProps { maxLeftYAxisValue?: number; maxRightYAxisValue?: number; selectedLeftYAxisLabel?: string; selectedRightYAxisLabel?: string; // generic function type, specific usage of value varies // eslint-disable-next-line no-unused-vars formatRightYAxisLabel?: (value: string) => string; // generic function type, specific usage of value varies // eslint-disable-next-line no-unused-vars formatLeftYAxisLabel?: (value: string) => string; } export interface GraphProps { data: GraphData; includeColors?: boolean; height?: number; spacingInner?: number; spacingOuter?: number; contentInset?: { top: number; bottom: number }; min?: number; numberOfTicks?: number; barColors?: Array; lineStrokeWidth?: number; useCommonScale?: boolean; yAxisProps?: YAxisProps; } /** * Common properties for graph render components. * * @interface CommonProps * @property {GraphData} data - The primary data source for the graph. * @property {number} [height] - Optional. The height of the graph. * @property {number} [spacingInner] - Optional. The inner spacing between elements in the graph. * @property {number} [spacingOuter] - Optional. The outer spacing of the elements in the graph. * @property {{ top: number; bottom: number }} [contentInset] - Optional. Insets for the content of the graph. * @property {number} [min] - Optional. The minimum value represented on the graph. * @property {number} [numberOfTicks] - Optional. The number of tick marks along the axis. * @property {Array} [barColors] - Optional. Colors used for bars in the graph. * @property {boolean} [useCommonScale] - Optional. Flag to use a common scale across multiple components. * @property {YAxisProps} [yAxisProps] - Optional. Properties for the Y-axis of the graph. * @property {string} [testID] - Optional. Identifier for testing purposes. */ export interface CommonProps { data: GraphData; height?: number; spacingInner?: number; spacingOuter?: number; contentInset?: { top: number; bottom: number }; min?: number; numberOfTicks?: number; barColors?: Array; lineStrokeWidth?: number; useCommonScale?: boolean; yAxisProps?: YAxisProps; testID?: string; }