Skip to content

Commit 44ab55b

Browse files
committed
numbers and spending bar
1 parent 99549c8 commit 44ab55b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/frontend/src/pages/FinancePage/FinanceComponents/PieChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const FinancePieChart: React.FC<FinancePieChartProps> = ({
203203
</Box>
204204
) : (
205205
<>
206-
<ResponsiveContainer width="100%" height={300} style={{ background: 'transparent' }}>
206+
<ResponsiveContainer width={250} height={250} style={{ background: 'transparent' }}>
207207
<RechartsPieChart margin={{ top: 0, right: 0, bottom: 20, left: 0 }} style={{ background: 'transparent' }}>
208208
<Pie
209209
data={adjustedData}

src/frontend/src/pages/FinancePage/FinanceComponents/SpendingBar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const SpendingBar = ({ data, title, edit }: SpendingBarProps) => {
160160
align: 'center',
161161
textAlign: 'center',
162162
formatter: (value, context) => {
163-
const realValue = value - average;
163+
const realValue = Math.round((value - average) * 100) / 100;
164164
let { label } = context.dataset;
165165
const datasetMeta = context.chart.getDatasetMeta(context.datasetIndex);
166166
const bar: any = datasetMeta.data[context.dataIndex];
@@ -207,10 +207,10 @@ const SpendingBar = ({ data, title, edit }: SpendingBarProps) => {
207207

208208
const title = context.dataset.label;
209209

210-
const value = context.parsed.x - average; // for horizontal bar, use .x — use .y for vertical
210+
const value = Math.round((context.parsed.x - average) * 100) / 100; // for horizontal bar, use .x — use .y for vertical
211211

212212
if (dataset.spendingInfo.totalBudget < getTotalMoneySpentNotAvailable(dataset.spendingInfo)) {
213-
return `Spending is $${Math.abs(dataset.spendingInfo.available)} overbudget!`;
213+
return `Spending is $${Math.abs(Math.round(dataset.spendingInfo.available * 100) / 100)} overbudget!`;
214214
}
215215

216216
return `${title}: $${value}`;

0 commit comments

Comments
 (0)