42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { ScaleLinear } from 'd3-scale'
|
|
|
|
export type ScaleFunction = ScaleLinear<number, number>;
|
|
|
|
export interface YAxisData {
|
|
key: string; // string value for ChartLabel component
|
|
values: number[];
|
|
// 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 interface GraphData {
|
|
xValues: string[];
|
|
yValues: YAxisData[];
|
|
}
|
|
|
|
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 Props {
|
|
data: GraphData;
|
|
height?: number;
|
|
spacingInner?: number;
|
|
spacingOuter?: number;
|
|
contentInset?: { top: number; bottom: number };
|
|
min?: number;
|
|
numberOfTicks?: number;
|
|
barColors?: Array<string>;
|
|
yAxisProps?: YAxisProps;
|
|
} |