From d70e2a955633734d5c19c2e76efb075ddf33327b Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Wed, 9 Aug 2023 12:29:12 -0400
Subject: more histogram cleanup

---
 src/client/views/nodes/DataVizBox/components/Histogram.tsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/components/Histogram.tsx')

diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
index 7bf546a62..e04d37094 100644
--- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx
+++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
@@ -286,11 +286,16 @@ export class Histogram extends React.Component<HistogramProps> {
                 translateXAxis = eachRectWidth / 2;
                 eachRectWidth = width/(bins.length)
             }
-            else eachRectWidth = width/(bins.length+1)
+            else {
+                eachRectWidth = width/(bins.length+1)
+                var tickDiff = (bins.length>=2? (bins[bins.length-2].x1!-bins[bins.length-2].x0!): 0)
+                var curDomain = x.domain();
+                x.domain([curDomain[0], curDomain[0] + tickDiff*bins.length])
+            }
 
-            x.range([0, width-eachRectWidth])
             xAxis = d3.axisBottom(x)
                 .ticks(bins.length-1)
+            x.range([0, width-eachRectWidth])
         }
         // y-axis
         const maxFrequency = this.numericalYData? d3.max(histDataSet, function(d: any) { 
-- 
cgit v1.2.3-70-g09d2

