Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const CustomTooltip = (currentSlice, totalRevByYear) => {
};

const determineIfZeroNeeded = value => {
if (value.toString().split('.')[1].length < 2) {
if (value.toString().split('.')[1]?.length < 2) {
return `${value}0`;
}
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const RevenueTrendsLineChart = ({ width, cpiDataByYear }) => {
}, [isLoading]);

useEffect(() => {
const endPointURL = 'v1/accounting/mts/mts_table_9?filter=record_type_cd:eq:RSG,record_calendar_month:eq:09&sort=-record_date';
const endPointURL = 'v1/accounting/mts/mts_table_9?filter=record_type_cd:eq:RSG,record_calendar_month:eq:09&page[size]=1000&sort=-record_date';
basicFetch(`${apiPrefix}${endPointURL}`).then(res => {
if (res.data) {
setLastChartYear(res.data[0].record_fiscal_year);
Expand Down Expand Up @@ -303,7 +303,21 @@ const RevenueTrendsLineChart = ({ width, cpiDataByYear }) => {
tickSize: 6,
tickPadding: 5,
tickRotation: 0,
tickValues: chartYears,
tickValues: (() => {
const start = 2016;
const end = lastChartYear;
const ticks = [];
for (let y = start; y <= end; y += 2) {
ticks.push(y);
}
const MAX_TICKS = 10;

if (ticks.length <= MAX_TICKS) {
return ticks;
}
const ratio = Math.ceil(ticks.length / MAX_TICKS);
return ticks.filter((_, i) => i % ratio === 0);
})(),
}}
axisLeft={{
format: formatCurrency,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ describe('revenue trends over time section', () => {
{ repeat: 1 }
);
fetchMock.get(
`https://www.transparency.treasury.gov/services/api/fiscal_service/v1/accounting/mts/mts_table_9?filter=record_type_cd:eq:RSG,record_calendar_month:eq:09&sort=-record_date`,
`https://www.transparency.treasury.gov/services/api/fiscal_service/v1/accounting/mts/mts_table_9?filter=record_type_cd:eq:RSG,record_calendar_month:eq:09&page[size]=1000&sort=-record_date`,
mockDataChart,
{ overwriteRoutes: true },
{ repeat: 1 }
Expand Down
4 changes: 4 additions & 0 deletions static/data/CPI/cpi_100.csv
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ year,period,value
2019,09,256.759
2020,09,260.280
2021,09,274.310
2022,09,296.421
2023,09,307.374
2024,09,314.851
2025,09,324.368
Loading