Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
76c7599
fix: correct 'netImpact' label to 'Net impact' in chart legend
vahid-ahmadi Jan 22, 2026
e67a873
fix: correct 'netChange' label to 'Net change' in decile chart legend
vahid-ahmadi Jan 22, 2026
07cb5bb
fix: make y-axis symmetric with round number ticks for budget chart
vahid-ahmadi Jan 22, 2026
ead4189
fix: make y-axis symmetric with round number ticks for decile chart
vahid-ahmadi Jan 22, 2026
b6ebbd5
fix: make decile chart y-axis consistent across all years
vahid-ahmadi Jan 22, 2026
278ebe2
fix: improve budget chart y-axis to ensure 0 is always included
vahid-ahmadi Jan 22, 2026
c1bcdfd
fix: change default year to 2027-28 for decile and local area charts
vahid-ahmadi Jan 22, 2026
36068ba
fix: update policy labels in map tooltip to use full names
vahid-ahmadi Jan 22, 2026
abf163c
fix: remove poverty rate reduction from map tooltip
vahid-ahmadi Jan 22, 2026
321f695
fix: remove fallback for policy display names
vahid-ahmadi Jan 22, 2026
2a08006
fix: change 'gain' to 'impact' in map tooltip and description
vahid-ahmadi Jan 22, 2026
ffc89c9
fix: make map color legend consistent across all years
vahid-ahmadi Jan 22, 2026
5107692
fix: change default year to 2028-29
vahid-ahmadi Jan 22, 2026
bed4c95
fix: update mansion tax link to official gov.scot source
vahid-ahmadi Jan 22, 2026
02b679a
fix: clarify mansion tax methodology and SFC position
vahid-ahmadi Jan 22, 2026
63afc0c
fix: remove example from LBTT behavioral effects text
vahid-ahmadi Jan 22, 2026
c6188c6
fix: combine mansion tax description into single paragraph
vahid-ahmadi Jan 22, 2026
f82bb9e
fix: rewrite methodology as sentences, add UK benchmark rate details
vahid-ahmadi Jan 22, 2026
74f7371
fix: update mansion tax rate calculation with actual formula
vahid-ahmadi Jan 22, 2026
2236552
fix: rewrite rate calculation as natural language
vahid-ahmadi Jan 22, 2026
9173835
fix: clarify £1,500 rate is extrapolated from UK £2,500 benchmark
vahid-ahmadi Jan 22, 2026
eba550e
fix: remove stray </invoke> tag causing JSX error
vahid-ahmadi Jan 22, 2026
3cf2683
fix: remove LBTT behavioral effects sentence from mansion tax descrip…
vahid-ahmadi Jan 22, 2026
888ee68
fix: change '£2-2.5m' to 'over £2m' for clarity
vahid-ahmadi Jan 22, 2026
3f30e20
fix: merge methodology points 1 and 2 into single coherent explanation
vahid-ahmadi Jan 22, 2026
6437a04
feat: add baseline vs reform line charts for threshold uplifts
vahid-ahmadi Jan 22, 2026
2080474
feat: replace tables with charts for freeze policy thresholds
vahid-ahmadi Jan 22, 2026
da4ec52
fix: update threshold charts and improve UI
vahid-ahmadi Jan 22, 2026
6afce60
style: reorganize dashboard sections and improve subsection styling
vahid-ahmadi Jan 22, 2026
c9f7f87
edit
vahid-ahmadi Jan 22, 2026
51a2d93
edit
vahid-ahmadi Jan 22, 2026
3525cc1
edit
vahid-ahmadi Jan 22, 2026
500ef0d
edits
vahid-ahmadi Jan 22, 2026
48911e5
test
vahid-ahmadi Jan 22, 2026
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
121 changes: 0 additions & 121 deletions public/data/winners_losers.csv

This file was deleted.

41 changes: 33 additions & 8 deletions src/components/BudgetBarChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export default function BudgetBarChart({ data, title, description, stacked = fal
// Check if we should show net impact line (only when multiple policies have data)
const showNetImpact = stacked && activePolicies.length > 1;

// Calculate Y-axis domain with padding (only for active/selected policies)
const calculateYDomain = () => {
// Calculate symmetric Y-axis domain with round number increments
const calculateYAxisConfig = () => {
let minVal = 0, maxVal = 0;
data.forEach(d => {
let negSum = 0, posSum = 0;
Expand All @@ -94,11 +94,35 @@ export default function BudgetBarChart({ data, title, description, stacked = fal
minVal = Math.min(minVal, negSum);
maxVal = Math.max(maxVal, posSum);
});
// Add 15% padding
const padding = Math.max(Math.abs(minVal), Math.abs(maxVal)) * 0.15;
return [Math.floor((minVal - padding) / 20) * 20, Math.ceil((maxVal + padding) / 20) * 20];

// Find the max absolute value
const maxAbs = Math.max(Math.abs(minVal), Math.abs(maxVal));

// Choose a nice round interval based on data range
let interval;
if (maxAbs <= 100) interval = 50;
else if (maxAbs <= 200) interval = 50;
else if (maxAbs <= 400) interval = 100;
else interval = 150;

// Round up to nice number for symmetric axis
const roundedMax = Math.ceil((maxAbs * 1.1) / interval) * interval || interval;

// Generate ticks from -roundedMax to +roundedMax, always including 0
const ticks = [];
for (let i = -roundedMax; i <= roundedMax; i += interval) {
ticks.push(i);
}

return {
domain: [-roundedMax, roundedMax],
ticks: ticks
};
};
const yDomain = stacked ? calculateYDomain() : ['auto', 'auto'];

const yAxisConfig = stacked ? calculateYAxisConfig() : { domain: ['auto', 'auto'], ticks: undefined };
const yDomain = yAxisConfig.domain;
const yTicks = yAxisConfig.ticks;

return (
<div className="budget-bar-chart">
Expand All @@ -119,13 +143,14 @@ export default function BudgetBarChart({ data, title, description, stacked = fal
/>
<YAxis
domain={yDomain}
ticks={yTicks}
tickFormatter={formatValue}
tick={{ fontSize: 12 }}
/>
<Tooltip
formatter={(value, name) => [
formatValue(value),
name === "netImpact" ? "Net impact" : name
name === "Net impact" ? "Net impact" : name
]}
labelFormatter={formatYear}
/>
Expand Down Expand Up @@ -171,7 +196,7 @@ export default function BudgetBarChart({ data, title, description, stacked = fal
stroke="#000000"
strokeWidth={2}
dot={{ fill: "#000000", stroke: "#000000", strokeWidth: 1, r: 4 }}
name="netImpact"
name="Net impact"
label={<NetImpactLabel />}
/>
)}
Expand Down
Loading