all period types
This commit is contained in:
@@ -17,6 +17,9 @@ export interface ChartDataPoint extends _ChartDataPoint {
|
|||||||
export interface ChartData {
|
export interface ChartData {
|
||||||
weekly?: Record<string, ChartDataPoint[]>;
|
weekly?: Record<string, ChartDataPoint[]>;
|
||||||
monthly?: Record<string, ChartDataPoint[]>;
|
monthly?: Record<string, ChartDataPoint[]>;
|
||||||
|
// yearly?: Record<string, ChartDataPoint[]>;
|
||||||
|
// fyly?: Record<string, ChartDataPoint[]>;
|
||||||
|
// full?: Record<string, ChartDataPoint[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HistoryChartProps {
|
export interface HistoryChartProps {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export default function HistoryChart(props: HistoryChartProps) {
|
|||||||
: 1;
|
: 1;
|
||||||
|
|
||||||
const visibleCountMap = { daily: 7, weekly: 6, monthly: 4 };
|
const visibleCountMap = { daily: 7, weekly: 6, monthly: 4 };
|
||||||
|
// const visibleCountMap = { daily: 7, weekly: 6, monthly: 4, yearly: 4, fyly: 4, full: 4 };
|
||||||
const visibleCount = visibleCountMap[activeDataKey];
|
const visibleCount = visibleCountMap[activeDataKey];
|
||||||
|
|
||||||
const total = currentData.length;
|
const total = currentData.length;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const configuration: DashboardConfig = {
|
|||||||
dataKey: "chartData",
|
dataKey: "chartData",
|
||||||
settings: {
|
settings: {
|
||||||
tabs: ["Weekly", "Monthly"],
|
tabs: ["Weekly", "Monthly"],
|
||||||
|
// tabs: ["Weekly", "Monthly", "Yearly", "Financial Year", "All Time"],
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
size: 12,
|
size: 12,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const sumBucket = (bucket: ReportBucket, flow: "expenses" | "incomes") =>
|
|||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
const toLabel = (start: string, end: string, type: "weekly" | "monthly") => {
|
const toLabel = (start: string, end: string, type: "weekly" | "monthly" | "yearly" | "fyly" | "full") => {
|
||||||
const s = new Date(start);
|
const s = new Date(start);
|
||||||
const e = new Date(end);
|
const e = new Date(end);
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ const getWeekOfMonth = (date: Date) => {
|
|||||||
const findCompareBucket = (
|
const findCompareBucket = (
|
||||||
current: ReportBucket,
|
current: ReportBucket,
|
||||||
buckets: ReportBucket[],
|
buckets: ReportBucket[],
|
||||||
type: "weekly" | "monthly"
|
type: "weekly" | "monthly" | "yearly" | "fyly" | "full",
|
||||||
): ReportBucket | undefined => {
|
): ReportBucket | undefined => {
|
||||||
const start = new Date(current.start);
|
const start = new Date(current.start);
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ const findCompareBucket = (
|
|||||||
|
|
||||||
const toPoints = (
|
const toPoints = (
|
||||||
buckets: ReportBucket[],
|
buckets: ReportBucket[],
|
||||||
type: "weekly" | "monthly",
|
type: "weekly" | "monthly" | "yearly" | "fyly" | "full",
|
||||||
flow: "expenses" | "incomes"
|
flow: "expenses" | "incomes"
|
||||||
): ChartDataPoint[] => {
|
): ChartDataPoint[] => {
|
||||||
return buckets.map((b) => {
|
return buckets.map((b) => {
|
||||||
@@ -143,6 +143,21 @@ export function mapReportToDashboard(
|
|||||||
rolling: toPoints(monthly, "monthly", flow),
|
rolling: toPoints(monthly, "monthly", flow),
|
||||||
calendar: toPoints(monthly, "monthly", flow),
|
calendar: toPoints(monthly, "monthly", flow),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// yearly: {
|
||||||
|
// rolling: toPoints(yearly, "yearly", flow),
|
||||||
|
// calendar: toPoints(yearly, "yearly", flow),
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
// fyly: {
|
||||||
|
// rolling: toPoints(fyly, "fyly", flow),
|
||||||
|
// calendar: toPoints(fyly, "fyly", flow),
|
||||||
|
// },
|
||||||
|
//
|
||||||
|
// full: {
|
||||||
|
// rolling: toPoints(full, "full", flow),
|
||||||
|
// calendar: toPoints(full, "full", flow),
|
||||||
|
// },
|
||||||
};
|
};
|
||||||
|
|
||||||
const totalAmount = weekly.reduce(
|
const totalAmount = weekly.reduce(
|
||||||
|
|||||||
Reference in New Issue
Block a user