UNPKG

2.79 kBTypeScriptView Raw
1/// <reference types="react" />
2import { ViewStyle } from "react-native";
3import AbstractChart, { AbstractChartConfig, AbstractChartProps } from "./AbstractChart";
4export interface StackedBarChartData {
5 labels: string[];
6 legend: string[];
7 data: number[][];
8 barColors: string[];
9}
10export interface StackedBarChartProps extends AbstractChartProps {
11 /**
12 * E.g.
13 * ```javascript
14 * const data = {
15 * labels: ["Test1", "Test2"],
16 * legend: ["L1", "L2", "L3"],
17 * data: [[60, 60, 60], [30, 30, 60]],
18 * barColors: ["#dfe4ea", "#ced6e0", "#a4b0be"]
19 * };
20 * ```
21 */
22 data: StackedBarChartData;
23 width: number;
24 height: number;
25 chartConfig: AbstractChartConfig;
26 hideLegend: boolean;
27 style?: Partial<ViewStyle>;
28 barPercentage?: number;
29 decimalPlaces?: number;
30 /**
31 * Show vertical labels - default: True.
32 */
33 withVerticalLabels?: boolean;
34 /**
35 * Show horizontal labels - default: True.
36 */
37 withHorizontalLabels?: boolean;
38 /**
39 * The number of horizontal lines
40 */
41 segments?: number;
42}
43declare type StackedBarChartState = {};
44declare class StackedBarChart extends AbstractChart<StackedBarChartProps, StackedBarChartState> {
45 getBarPercentage: () => number;
46 getBarRadius: (ret: string | any[], x: string | any[]) => number;
47 renderBars: ({ data, width, height, paddingTop, paddingRight, border, colors, stackedBar }: Pick<Pick<AbstractChartConfig, "color" | "style" | "height" | "width" | "propsForBackgroundLines" | "propsForLabels" | "labelColor" | "count" | "paddingTop" | "paddingRight" | "horizontalLabelRotation" | "formatYLabel" | "labels" | "horizontalOffset" | "stackedBar" | "verticalLabelRotation" | "formatXLabel" | "backgroundColor" | "backgroundGradientFrom" | "backgroundGradientFromOpacity" | "backgroundGradientTo" | "backgroundGradientToOpacity" | "fillShadowGradient" | "fillShadowGradientOpacity" | "useShadowColorFromDataset" | "strokeWidth" | "barPercentage" | "barRadius" | "propsForDots" | "decimalPlaces" | "linejoinType" | "scrollableDotFill" | "scrollableDotStrokeColor" | "scrollableDotStrokeWidth" | "scrollableDotRadius" | "scrollableInfoViewStyle" | "scrollableInfoTextStyle" | "scrollableInfoTextDecorator" | "scrollableInfoOffset" | "scrollableInfoSize">, "height" | "width" | "paddingTop" | "paddingRight" | "stackedBar"> & {
48 border: number;
49 colors: string[];
50 data: number[][];
51 }) => any[][];
52 renderLegend: ({ legend, colors, width, height }: Pick<AbstractChartConfig, "height" | "width"> & {
53 legend: string[];
54 colors: string[];
55 }) => JSX.Element[];
56 render(): JSX.Element;
57}
58export default StackedBarChart;
59//# sourceMappingURL=StackedBarChart.d.ts.map
\No newline at end of file