UNPKG

@frontify/fondue-charts

Version:

Frontify's data viz library

211 lines (172 loc) • 6.38 kB
import { AxisScale } from '@visx/xychart'; import { EventHandlerParams } from '@visx/xychart'; import { JSX as JSX_2 } from 'react'; import { ReactNode } from 'react'; import { ScaleBand } from 'd3-scale'; export declare const AreaStackChart: ({ width, height, series, missingValueLabel, locale, hideLegend, legendPosition, markLine, valueFormatter, childSumLabel, domain, }: AreaStackChartProps) => JSX_2.Element; declare type AreaStackChartDataPoint = { timestamp: Date; value: number | null; description?: string; }; declare type AreaStackChartProps = { series: AreaStackChartSeries[]; height: number; width?: number; missingValueLabel?: string; childSumLabel?: string; locale?: string; hideLegend?: boolean; legendPosition?: LegendPosition; markLine?: MarkLineProps; valueFormatter?: ValueFormatter; domain?: 'storage' | 'count'; }; declare type AreaStackChartSeries = { dataPoints: AreaStackChartDataPoint[]; name: string; }; export declare const BarChart: <DataPointDetails extends Record<string, any> | void = void>({ series, height, width, horizontal, displayStyle, hideLegend, allowDecimalTickValues, legendPosition, valueFormatter, labelFormatter, maxLabelLength, onBarClick, }: BarChartProps<DataPointDetails>) => JSX_2.Element; export declare type BarChartClickHandlerParams<DataPointDetails extends Record<string, any> | void = void> = EventHandlerParams<BarChartDataPoint<DataPointDetails>>; export declare type BarChartDataPoint<DataPointDetails extends Record<string, any> | void = void> = DataPointDetails extends void ? BarChartDataPointBase : BarChartDataPointBase & { details: DataPointDetails; }; declare type BarChartDataPointBase = { label: string; value: number | null; description?: string; valueContext?: string; imageUrl?: string; }; export declare type BarChartProps<DataPointDetails extends Record<string, any> | void = void> = { series: BarChartSeries<DataPointDetails>[]; height: number; width?: number; displayStyle?: DisplayStyle; horizontal?: boolean; hideLegend?: boolean; allowDecimalTickValues?: boolean; legendPosition?: LegendPosition_2; valueFormatter?: ValueFormatter; labelFormatter?: LabelFormatter; maxLabelLength?: number; onBarClick?: (e: BarChartClickHandlerParams<DataPointDetails>) => void; }; export declare type BarChartSeries<DataPointDetails extends Record<string, any> | void = void> = { name: string; dataPoints: BarChartDataPoint<DataPointDetails>[]; }; export declare const ChartHeading: ({ title, description, icon }: ChartHeadingProps) => JSX_2.Element; export declare type ChartHeadingProps = { title: ReactNode | string; description?: string; icon?: ReactNode; }; declare type ColorLabelMap = Record<string, { singular: string; plural: string; group: (groupLength: number) => string; }>; export declare type DisplayStyle = 'default' | 'overlapped'; export declare const isBandScale: (scale: AxisScale) => scale is ScaleBand<string>; declare type LabelFormatter = (label: string) => string; export declare type LegendPosition = 'top' | 'bottom'; declare type LegendPosition_2 = 'top' | 'bottom'; export declare const LinearGauge: ({ sections, totalLabel, totalValue }: LinearGaugeProps) => JSX_2.Element; export declare type LinearGaugeProps = { sections: LinearGaugeSection[]; } & ({ totalLabel: string; totalValue: string; } | { totalLabel?: never; totalValue?: never; }); declare type LinearGaugeSection = { name: string; label: string; percentage: number; }; export declare type LinearGaugeTooltipState = { x: number; y: number; }; export declare const LineChart: ({ width, height, series, missingValueLabel, locale, hideGlyphs, hideArea, hideLegend, legendPosition, highlightNegativeValues, markLine, valueFormatter, }: LineChartProps) => JSX_2.Element; export declare type LineChartDataPoint = { timestamp: Date; value: number | null; description?: string; valueContext?: string; }; export declare type LineChartProps = { series: LineChartSeries[]; height: number; width?: number; missingValueLabel?: string; locale?: string; hideGlyphs?: boolean; hideArea?: boolean; hideLegend?: boolean; legendPosition?: LegendPosition; highlightNegativeValues?: boolean; markLine?: MarkLineProps; valueFormatter?: ValueFormatter; }; export declare type LineChartSeries = { dataPoints: LineChartDataPoint[]; name: string; }; export declare type MarkLineProps = { name: string; value: number; }; export declare type Padding = { top: number; right: number; bottom: number; left: number; }; export declare const PieChart: ({ size: sizeProp, data, valueFormatter, showLabelTitle, showLabelValue, showLabelPercentage, shouldSortData, }: PieChartProps) => JSX_2.Element; export declare type PieChartDatum = { value: number; label: string; }; export declare type PieChartProps = { size: number; data: PieChartDatum[]; valueFormatter?: ValueFormatter; showLabelTitle?: boolean; showLabelValue?: boolean; showLabelPercentage?: boolean; shouldSortData?: boolean; }; declare type SizeThresholds = { mobile: number; desktop: number; }; export declare const Treemap: ({ data, childSumLabel, missingValueLabel, colorLabelMap, valueFormatter, width, height, legendItems, sizeThresholds, }: TreemapProps) => JSX_2.Element; declare type TreemapDataPoint = { id: string; label: string; value: number | null; parentId: string | null; description?: string; color?: string; }; declare type TreemapLegendItem = { color: string; label: string; }; declare type TreemapProps = { data: TreemapDataPoint[]; childSumLabel: string; missingValueLabel?: string; colorLabelMap?: ColorLabelMap; valueFormatter?: ValueFormatter; width: number; height: number; legendItems?: TreemapLegendItem[]; sizeThresholds?: SizeThresholds; }; declare type ValueFormatter = (value: number) => string; export { }