Skip to content

Commit

Permalink
Merge pull request #271 from ORNL-AMO/issue-253
Browse files Browse the repository at this point in the history
Issue 253: EoY graphs
  • Loading branch information
nbintertech authored Mar 15, 2024
2 parents 028c905 + 10e2f9b commit 6b3c729
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/YearRecapCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,26 @@ export default function YearRecapChart(props: BarsProps) {
}),
[xMax],
);

let yDomain: number = 0;
let barGraphDataMax: number = 0;
props.barGraphData.forEach(data => {
if(data > barGraphDataMax){
barGraphDataMax = data;
}
});
if (barGraphDataMax > props.domainYaxis){
yDomain = Math.ceil(barGraphDataMax);
} else {
yDomain = props.domainYaxis;
}

const yScale = useMemo(
() =>
scaleLinear<number>({
range: [yMax, 0],
round: true,
domain: [0, props.domainYaxis],
domain: [0, yDomain],
}),
[yMax],
);
Expand Down

0 comments on commit 6b3c729

Please sign in to comment.