From be70b8918438bae2f4474498aaffa1db5581e8de Mon Sep 17 00:00:00 2001 From: Teale Fristoe Date: Tue, 10 Dec 2024 15:48:26 -0800 Subject: [PATCH] Add buffer space to bar charts. (#1681) --- v3/src/components/graph/components/freedotplotdots.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v3/src/components/graph/components/freedotplotdots.tsx b/v3/src/components/graph/components/freedotplotdots.tsx index f7fd350969..5808f290eb 100644 --- a/v3/src/components/graph/components/freedotplotdots.tsx +++ b/v3/src/components/graph/components/freedotplotdots.tsx @@ -83,10 +83,10 @@ export const FreeDotPlotDots = observer(function FreeDotPlotDots(props: PlotProp const getBarStaticDimension = () => { // This function determines how much space is available for each bar on the non-primary axis by dividing the - // length of the non-primary axis by the number of cases in the subplot containing the most cases. This keeps - // the bars a uniform size across subplots. + // length of the non-primary axis by one more than the number of cases in the subplot containing the most cases. + // This keeps the bars a uniform size across subplots. const largestSubplotCount = Math.max(...Array.from(subPlotDetails.values()).map(sp => sp.cases.length)) - return largestSubplotCount ? secondaryBandwidth / largestSubplotCount : 0 + return largestSubplotCount ? secondaryBandwidth / (largestSubplotCount + 1) : 0 } const getBarValueDimension = (anID: string) => {