@chartiful/react-chart-builder
Version:
Foundation to React charts.
76 lines (75 loc) • 2.25 kB
TypeScript
/// <reference types="react" />
import type { BaseChartConfig } from '../../types';
interface Config extends BaseChartConfig {
data: number[];
labels?: string[];
height: number;
width: number;
}
export default class ChartBuilder {
data: number[];
labels: string[];
startAtZero: boolean;
height: number;
width: number;
hasXAxisLabels?: boolean;
hasYAxisLabels?: boolean;
xAxisLabelCount: number;
yAxisLabelCount?: number;
xAxisPrefix?: string;
xAxisSuffix?: string;
xAxisLabelStyle?: {
fontFamily?: string;
fontSize?: number;
fontWeight?: number;
color?: string;
rotation?: number;
xOffset?: number;
yOffset?: number;
prefix?: string;
suffix?: string;
position?: string;
width?: number;
decimals?: number;
};
yAxisLabelStyle?: {
fontFamily?: string;
fontSize?: number;
fontWeight?: number;
color?: string;
rotation?: number;
xOffset?: number;
yOffset?: number;
position?: string;
height?: number;
};
hasXAxisBackgroundLines?: boolean;
hasYAxisBackgroundLines?: boolean;
xAxisBackgroundLineStyle?: {
strokeWidth?: number;
color?: string;
};
yAxisBackgroundLineStyle?: {
strokeWidth?: number;
color?: string;
};
minVal: number;
maxVal: number;
baseHeight: number;
Y_AXIS_LABEL_HEIGHT: number;
X_AXIS_LABEL_WIDTH: number;
xAxisLabelWidth: number;
leftAlignedXAxisLabelWidth: number;
xAxisLabelPosition: string;
private yDistanceBetweenXLabels;
yAxisLabelHeight: number;
yLabelSlotWidth: number;
private deltaBetweenGreatestAndLeast;
constructor({ data, labels, startAtZero, height, width, hasXAxisLabels, hasYAxisLabels, xAxisLabelCount, xAxisLabelStyle, yAxisLabelStyle, hasXAxisBackgroundLines, hasYAxisBackgroundLines, xAxisBackgroundLineStyle, yAxisBackgroundLineStyle }: Config);
calcDataPointHeight(val: number): number;
renderXAxisLines(): JSX.Element[];
renderYAxisLines(): JSX.Element[];
renderXAxisLabels(): JSX.Element[];
renderYAxisLabels(): JSX.Element[];
}
export {};