feat: introduced stacked bar chart and tree map chart. (#6305)

This commit is contained in:
Prateek Shourya 2025-01-03 14:24:14 +05:30 committed by GitHub
parent 873e4330bc
commit d6bcd8dd15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 460 additions and 0 deletions

53
packages/types/src/charts.d.ts vendored Normal file
View file

@ -0,0 +1,53 @@
export type TStackItem<T extends string> = {
key: T;
fillClassName: string;
textClassName: string;
dotClassName?: string;
showPercentage?: boolean;
};
export type TStackChartData<K extends string, T extends string> = {
[key in K]: string | number;
} & Record<T, any>;
export type TStackedBarChartProps<K extends string, T extends string> = {
data: TStackChartData<K, T>[];
stacks: TStackItem<T>[];
xAxis: {
key: keyof TStackChartData<K, T>;
label: string;
};
yAxis: {
key: keyof TStackChartData<K, T>;
label: string;
domain?: [number, number];
allowDecimals?: boolean;
};
barSize?: number;
className?: string;
tickCount?: {
x?: number;
y?: number;
};
showTooltip?: boolean;
};
export type TreeMapItem = {
name: string;
value: number;
textClassName?: string;
icon?: React.ReactElement;
} & (
| {
fillColor: string;
}
| {
fillClassName: string;
}
);
export type TreeMapChartProps = {
data: TreeMapItem[];
className?: string;
isAnimationActive?: boolean;
};

View file

@ -37,3 +37,4 @@ export * from "./command-palette";
export * from "./timezone";
export * from "./activity";
export * from "./epics";
export * from "./charts";