From a91b4f1ef28c87e7569624ac754966c83acfca6b Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Mon, 12 Feb 2024 16:21:13 -0500 Subject: [PATCH] fix(charts): correct # of bar chart dividing lines --- src/Components/Charts/BentoBarChart.tsx | 2 +- test/js/TestBarChart.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Components/Charts/BentoBarChart.tsx b/src/Components/Charts/BentoBarChart.tsx index 37b26ae..515807e 100644 --- a/src/Components/Charts/BentoBarChart.tsx +++ b/src/Components/Charts/BentoBarChart.tsx @@ -64,7 +64,7 @@ const BentoBarChart = ({ height, width, units, title, onClick, colorTheme = 'def const cartesianGridVerticalCoordinatesGenerator: CartesianGridProps['verticalCoordinatesGenerator'] = ({ xAxis }) => { const points = [xAxis?.x ?? 0]; - for (let i = 0; i <= xAxis?.tickCount; i++) { + for (let i = 0; i <= data.length; i++) { points.push(points[i] + xAxis.bandSize); } return points; diff --git a/test/js/TestBarChart.tsx b/test/js/TestBarChart.tsx index 39c7a7d..d0a0690 100644 --- a/test/js/TestBarChart.tsx +++ b/test/js/TestBarChart.tsx @@ -16,6 +16,11 @@ const TestBarChart: React.FC = () => { { x: 'SB', y: 60 }, { x: 'AU', y: 30 }, { x: 'XA', y: 80 }, + { x: 'BB', y: 50 }, + { x: 'BC', y: 75 }, + { x: 'BD', y: 60 }, + { x: 'BE', y: 30 }, + { x: 'BF', y: 80 }, ]} units="management units" height={sizeStateFixed.height}