Skip to content
This repository was archived by the owner on Nov 20, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/desktop-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"#components/reports/getLiveRange": "./src/components/reports/getLiveRange.ts",
"#components/reports/monthRange": "./src/components/reports/monthRange.ts",
"#components/reports/graphs/showActivity": "./src/components/reports/graphs/showActivity.ts",
"#components/reports/graphs/tableGraph/report-display-rounding": "./src/components/reports/graphs/tableGraph/report-display-rounding.ts",
"#components/reports/graphs/util/computePadding": "./src/components/reports/graphs/util/computePadding.ts",
"#components/reports/graphs/util/monteCarloCashflowChart": "./src/components/reports/graphs/util/monteCarloCashflowChart.ts",
"#components/reports/graphs/util/useMonteCarloTickFormatter": "./src/components/reports/graphs/util/useMonteCarloTickFormatter.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {

import { FinancialText } from '#components/FinancialText';
import { PrivacyFilter } from '#components/PrivacyFilter';
import { createReportAmountFormatter } from '#components/reports/graphs/tableGraph/report-display-rounding';
import { useDateFormat } from '#hooks/useDateFormat';
import { useFormat } from '#hooks/useFormat';
import { useLocale } from '#hooks/useLocale';
Expand All @@ -39,6 +40,7 @@ export function ReportSummary({
const locale = useLocale();
const { t } = useTranslation();
const format = useFormat();
const formatAmount = createReportAmountFormatter(format);
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
const intervalFormat = getIntervalFormat(interval, dateFormat);

Expand Down Expand Up @@ -113,9 +115,7 @@ export function ReportSummary({
fontWeight: 800,
}}
>
<PrivacyFilter>
{format(data[balanceTypeOp], 'financial')}
</PrivacyFilter>
<PrivacyFilter>{formatAmount(data[balanceTypeOp])}</PrivacyFilter>
</FinancialText>
<Text style={{ fontWeight: 600 }}>
<Trans>For this time period</Trans>
Expand Down Expand Up @@ -155,7 +155,7 @@ export function ReportSummary({
}}
>
<PrivacyFilter>
{!isNaN(average) && format(average, 'financial')}
{!isNaN(average) && formatAmount(average)}
</PrivacyFilter>
</FinancialText>
<Text style={{ fontWeight: 600 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import { FinancialText } from '#components/FinancialText';
import { useRechartsAnimation } from '#components/reports/chart-theme';
import { Container } from '#components/reports/Container';
import { useFormat } from '#hooks/useFormat';
import type { FormatType } from '#hooks/useFormat';
import { usePrivacyMode } from '#hooks/usePrivacyMode';

import { adjustTextSize } from './adjustTextSize';
import { renderCustomLabel } from './renderCustomLabel';
import { createReportAmountFormatter } from './tableGraph/report-display-rounding';
import type { ReportAmountFormatter } from './tableGraph/report-display-rounding';

type PayloadItem = {
payload: {
Expand All @@ -46,7 +47,7 @@ type CustomTooltipProps = {
active?: boolean;
payload?: PayloadItem[];
balanceTypeOp: balanceTypeOpType;
format: (value: unknown, type: FormatType) => string;
format: ReportAmountFormatter;
};

const CustomTooltip = ({
Expand Down Expand Up @@ -154,7 +155,7 @@ const customLabel = ({
props: LabelProps;
width: number;
end: number;
format: (value: unknown, type: FormatType) => string;
format: ReportAmountFormatter;
}) => {
//Add margin to first and last object
const calcX =
Expand Down Expand Up @@ -192,6 +193,7 @@ export function AreaGraph({
showTooltip = true,
}: AreaGraphProps) {
const format = useFormat();
const formatAmount = createReportAmountFormatter(format);
const animationProps = useRechartsAnimation({ animationDuration: 1000 });

const privacyMode = usePrivacyMode();
Expand All @@ -217,7 +219,7 @@ export function AreaGraph({
const lastLabel = data.intervalData.length - 1;

const tickFormatter = (tick: number) => {
if (!privacyMode) return `${format(tick, 'financial-no-decimals')}`; // Formats the tick values as strings with commas
if (!privacyMode) return `${formatAmount(tick, 'financial-no-decimals')}`; // Formats the tick values as strings with commas
return '...';
};

Expand Down Expand Up @@ -286,7 +288,7 @@ export function AreaGraph({
content={
<CustomTooltip
balanceTypeOp={balanceTypeOp}
format={format}
format={formatAmount}
/>
}
isAnimationActive={false}
Expand Down Expand Up @@ -349,7 +351,7 @@ export function AreaGraph({
props,
width,
end: lastLabel,
format,
format: formatAmount,
})
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ import { numberFormatterTooltip } from '#components/reports/numberFormatter';
import { useAccounts } from '#hooks/useAccounts';
import { useCategories } from '#hooks/useCategories';
import { useFormat } from '#hooks/useFormat';
import type { FormatType } from '#hooks/useFormat';
import { useNavigate } from '#hooks/useNavigate';
import { usePrivacyMode } from '#hooks/usePrivacyMode';

import { adjustTextSize } from './adjustTextSize';
import { renderCustomLabel } from './renderCustomLabel';
import { showActivity } from './showActivity';
import { createReportAmountFormatter } from './tableGraph/report-display-rounding';
import type { ReportAmountFormatter } from './tableGraph/report-display-rounding';

type PayloadChild = {
props: {
Expand Down Expand Up @@ -69,10 +70,10 @@ type CustomTooltipProps = {
payload?: PayloadItem[];
balanceTypeOp?: balanceTypeOpType;
yAxis?: string;
format: (value: unknown, type: FormatType) => string;
format: ReportAmountFormatter;
};

const CustomTooltip = ({
export const CustomTooltip = ({
active,
payload,
balanceTypeOp,
Expand Down Expand Up @@ -224,6 +225,7 @@ export function BarGraph({
const { data: accounts = [] } = useAccounts();
const privacyMode = usePrivacyMode();
const format = useFormat();
const formatAmount = createReportAmountFormatter(format);

const [pointer, setPointer] = useState('');

Expand Down Expand Up @@ -281,7 +283,7 @@ export function BarGraph({
<CustomTooltip
balanceTypeOp={balanceTypeOp}
yAxis={yAxis}
format={format}
format={formatAmount}
/>
}
formatter={numberFormatterTooltip}
Expand All @@ -302,7 +304,7 @@ export function BarGraph({
<YAxis
tickFormatter={value =>
getCustomTick(
format(value, 'financial-no-decimals'),
formatAmount(value, 'financial-no-decimals'),
privacyMode,
)
}
Expand Down Expand Up @@ -357,7 +359,7 @@ export function BarGraph({
{viewLabels && !compact && (
<LabelList
dataKey={val => getVal(val)}
content={e => customLabel(e, balanceTypeOp, format)}
content={e => customLabel(e, balanceTypeOp, formatAmount)}
/>
)}
</Bar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { isTouchDevice } from '#util/isTouchDevice';
import { adjustTextSize } from './adjustTextSize';
import { renderCustomLabel } from './renderCustomLabel';
import { showActivity } from './showActivity';
import { createReportAmountFormatter } from './tableGraph/report-display-rounding';
import type { ReportAmountFormatter } from './tableGraph/report-display-rounding';

const RADIAN = Math.PI / 180;

Expand Down Expand Up @@ -140,9 +142,10 @@ type ActiveShapeProps = {
chartInnerRadius: number;
chartMidRadius: number;
chartOuterRadius: number;
formatAmount: ReportAmountFormatter;
};

const ActiveShapeMobile = ({
export const ActiveShapeMobile = ({
cx,
cy,
innerRadius,
Expand All @@ -156,8 +159,8 @@ const ActiveShapeMobile = ({
expandInward,
chartInnerRadius,
chartOuterRadius,
formatAmount,
}: ActiveShapeProps) => {
const format = useFormat();
// Fix 2: guard against undefined payload.name and payload.date
const yAxis = payload.name ?? payload.date ?? '';

Expand All @@ -183,7 +186,7 @@ const ActiveShapeMobile = ({
textAnchor="end"
fill={fill}
>
{format(value, 'financial')}
{formatAmount(value, 'financial')}
</FinancialText>
<text
x={cx + chartOuterRadius * Math.cos(-RADIAN * 330) + 10}
Expand Down Expand Up @@ -216,7 +219,7 @@ const ActiveShapeMobile = ({
);
};

const ActiveShapeDesktop = ({
export const ActiveShapeDesktop = ({
cx,
cy,
midAngle,
Expand All @@ -230,8 +233,8 @@ const ActiveShapeDesktop = ({
value,
expandInward,
chartInnerRadius,
formatAmount,
}: ActiveShapeProps) => {
const format = useFormat();
// Fix 2: guard against undefined payload.name and payload.date
const yAxis = payload.name ?? payload.date ?? '';
const sin = Math.sin(-RADIAN * midAngle);
Expand Down Expand Up @@ -291,7 +294,7 @@ const ActiveShapeDesktop = ({
textAnchor={textAnchor}
fill={fill}
>
{format(value, 'financial')}
{formatAmount(value, 'financial')}
</FinancialText>
<text x={labelX} y={ey} dy={36} textAnchor={textAnchor} fill="#999">
{`(${(percent * 100).toFixed(2)}%)`}
Expand Down Expand Up @@ -356,6 +359,7 @@ export function DonutGraph({
showOffBudget,
showTooltip = true,
}: DonutGraphProps) {
const formatAmount = createReportAmountFormatter(useFormat());
const animationProps = useRechartsAnimation({ animationDuration: 500 });

const yAxis = groupBy === 'Interval' ? 'date' : 'name';
Expand Down Expand Up @@ -470,6 +474,7 @@ export function DonutGraph({
chartInnerRadius={chartInnerRadius}
chartMidRadius={chartMidRadius}
chartOuterRadius={chartOuterRadius}
formatAmount={formatAmount}
/>
) : (
<ActiveShapeDesktop
Expand All @@ -479,6 +484,7 @@ export function DonutGraph({
chartInnerRadius={chartInnerRadius}
chartMidRadius={chartMidRadius}
chartOuterRadius={chartOuterRadius}
formatAmount={formatAmount}
/>
);
}
Expand Down Expand Up @@ -552,6 +558,7 @@ export function DonutGraph({
chartInnerRadius={chartInnerRadius}
chartMidRadius={chartMidRadius}
chartOuterRadius={chartOuterRadius}
formatAmount={formatAmount}
/>
) : (
<ActiveShapeDesktop
Expand All @@ -561,6 +568,7 @@ export function DonutGraph({
chartInnerRadius={chartInnerRadius}
chartMidRadius={chartMidRadius}
chartOuterRadius={chartOuterRadius}
formatAmount={formatAmount}
/>
);
}
Expand Down Expand Up @@ -647,6 +655,7 @@ export function DonutGraph({
chartInnerRadius={chartInnerRadius}
chartMidRadius={chartMidRadius}
chartOuterRadius={chartOuterRadius}
formatAmount={formatAmount}
/>
) : (
<ActiveShapeDesktop
Expand All @@ -656,6 +665,7 @@ export function DonutGraph({
chartInnerRadius={chartInnerRadius}
chartMidRadius={chartMidRadius}
chartOuterRadius={chartOuterRadius}
formatAmount={formatAmount}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import { numberFormatterTooltip } from '#components/reports/numberFormatter';
import { useAccounts } from '#hooks/useAccounts';
import { useCategories } from '#hooks/useCategories';
import { useFormat } from '#hooks/useFormat';
import type { FormatType } from '#hooks/useFormat';
import { useNavigate } from '#hooks/useNavigate';
import { usePrivacyMode } from '#hooks/usePrivacyMode';

import { showActivity } from './showActivity';
import { createReportAmountFormatter } from './tableGraph/report-display-rounding';
import type { ReportAmountFormatter } from './tableGraph/report-display-rounding';
import { computeTrendLines } from './util/computeTrendLines';

type PayloadItem = {
Expand All @@ -53,7 +54,7 @@ type CustomTooltipProps = {
legend: LegendEntity[];
active?: boolean;
payload?: PayloadItem[];
format: (value: unknown, type: FormatType) => string;
format: ReportAmountFormatter;
};

const CustomTooltip = ({
Expand Down Expand Up @@ -175,6 +176,7 @@ export function LineGraph({
const { data: accounts = [] } = useAccounts();
const privacyMode = usePrivacyMode();
const format = useFormat();
const formatAmount = createReportAmountFormatter(format);

const [pointer, setPointer] = useState('');
const [tooltip, setTooltip] = useState('');
Expand Down Expand Up @@ -234,7 +236,7 @@ export function LineGraph({
compact={compact}
tooltip={tooltip}
legend={data.legend}
format={format}
format={formatAmount}
/>
}
formatter={numberFormatterTooltip}
Expand All @@ -253,7 +255,7 @@ export function LineGraph({
<YAxis
tickFormatter={value =>
getCustomTick(
format(value, 'financial-no-decimals'),
formatAmount(value, 'financial-no-decimals'),
privacyMode,
)
}
Expand Down
Loading
Loading