recharts
Version:
React charts
53 lines (52 loc) • 3.81 kB
TypeScript
import { ReactElement } from 'react';
import { Series } from 'victory-vendor/d3-shape';
import { RechartsRootState } from '../store';
import { BarPositionPosition, StackId } from '../../util/ChartUtils';
import { DataKey } from '../../util/types';
import { BarRectangleItem } from '../../cartesian/Bar';
import { StackDataPoint, StackSeriesIdentifier } from '../../util/stacks/stackTypes';
import { BarSettings } from '../types/BarSettings';
import { GraphicalItemId } from '../graphicalItemsSlice';
import { BarCategory } from './combiners/combineBarSizeList';
export declare const selectMaxBarSize: (_state: RechartsRootState, id: GraphicalItemId) => number | undefined;
export declare const selectAllVisibleBars: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => ReadonlyArray<BarSettings>;
export type SizeList = ReadonlyArray<BarCategory>;
export declare const selectBarCartesianAxisSize: (state: RechartsRootState, id: GraphicalItemId) => number | undefined;
export declare const selectBarSizeList: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => SizeList;
export declare const selectBarBandSize: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => number;
export declare const selectAxisBandSize: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => number | undefined;
export type BarWithPosition = {
stackId: StackId | undefined;
/**
* List of dataKeys of items stacked at this position.
* All of these Bars are either sharing the same stackId,
* or this is an array with one Bar because it has no stackId defined.
*
* This structure limits us to having one dataKey only once per stack which I think is reasonable.
* People who want to have the same data twice can duplicate their data to have two distinct dataKeys.
*/
dataKeys: ReadonlyArray<DataKey<any>>;
/**
* Position of this stack in absolute pixels measured from the start of the chart
*/
position: BarPositionPosition;
};
export declare const selectAllBarPositions: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => ReadonlyArray<BarWithPosition> | undefined;
export declare const selectBarPosition: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => BarPositionPosition | undefined;
export declare const selectStackedDataOfItem: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => Series<StackDataPoint, StackSeriesIdentifier> | undefined;
/**
* When a stacked segment is shorter than its `minPointSize`, it gets inflated to that minimum size.
* That inflation always keeps the segment's base-ward edge (the edge touching the previous segment in
* the stack) fixed and only extends the far edge - so a segment stacked on top of an inflated one would
* otherwise start from the segment's *natural* (un-inflated) position and overlap it.
*
* This selector computes, per data index, how far the segments *before* this one in the stack were
* pushed out by their own `minPointSize` inflation, so that this segment's whole rectangle can be
* translated by the same amount and stay attached without overlapping.
*
* Sign follows the same convention as the per-segment inflation delta: positive means "further away
* from the stack's zero baseline", matching whichever direction that already means in `computeBarRectangles`
* for the given layout.
*/
export declare const selectStackedMinPointSizeShift: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean) => ReadonlyArray<number> | undefined;
export declare const selectBarRectangles: (state: RechartsRootState, id: GraphicalItemId, isPanorama: boolean, cells: ReadonlyArray<ReactElement> | undefined) => ReadonlyArray<BarRectangleItem> | undefined;