18 lines
395 B
TypeScript
18 lines
395 B
TypeScript
export type CategoryBreakdownItem = {
|
|
name: string;
|
|
amount: number;
|
|
color: string;
|
|
block?: "wiederkehrend" | "variabel";
|
|
};
|
|
|
|
export type CategoryPieItem = CategoryBreakdownItem & {
|
|
chartAmount: number;
|
|
};
|
|
|
|
export function toCategoryPieData(data: CategoryBreakdownItem[]): CategoryPieItem[] {
|
|
return data.map((item) => ({
|
|
...item,
|
|
chartAmount: Math.abs(item.amount),
|
|
}));
|
|
}
|