UNPKG

fybdp-d3-kg

Version:

Knowledge Graph using React and D3.js

86 lines (85 loc) 2.42 kB
import { Component } from 'react'; import { Dimensions, Margins } from '../utils/dimensions'; import { ResizeEvent } from './ResizeContainer'; import { LinearAxisDimensionChanged } from '../Axis'; export interface ChartProps { /** * Id of the chart. */ id?: string; /** * Width of the chart. If not provided will autosize. */ width?: number; /** * Height of the chart. If not provided will autosize. */ height?: number; /** * Margins for the chart. */ margins?: Margins; /** * Classnames for the chart. */ className?: any; /** * Additional css styles. */ style?: any; /** * Center the chart. Used mainly internally. */ center?: boolean; /** * Center chart on X Axis only. Used mainly internally. */ centerX?: boolean; /** * Center chart on Y Axis only. Used mainly internally. */ centerY?: boolean; } export interface ChartContainerProps extends ChartProps { /** * Internal property to identify if the xAxis is visible. */ xAxisVisible?: boolean; /** * Internal property to identify if the xAxis is visible. */ yAxisVisible?: boolean; /** * Children elements to recieve the calculated props. */ children: (props: ChartContainerChildProps) => any; } export interface ChartContainerChildProps extends ChartContainerState { updateAxes: (e: any) => void; } export interface ChartContainerState extends Dimensions { id: string; chartSized?: boolean; yAxisSized?: boolean; xAxisSized?: boolean; } interface UpdateSizeProps { chartSized?: boolean; xAxisSized?: boolean; yAxisSized?: boolean; yOffset?: number; xOffset?: number; height?: number; width?: number; } export declare class ChartContainer extends Component<ChartContainerProps, ChartContainerState> { static defaultProps: Partial<ChartContainerProps>; constructor(props: ChartContainerProps); componentDidUpdate(nextProps: ChartContainerProps): void; onResize(event: ResizeEvent): void; updateAxes(orientation: 'horizontal' | 'vertical', event: LinearAxisDimensionChanged): void; updateSize(props: UpdateSizeProps): void; getChartSized(): boolean; render(): JSX.Element; } export {};