aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-08-09 12:29:12 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-08-09 12:29:12 -0400
commitd70e2a955633734d5c19c2e76efb075ddf33327b (patch)
tree66478facd10aa5c0548e1c00849515d2a3a38632 /src
parent5a77db9f5f1e842c59d071f230c09f5f94018ea1 (diff)
more histogram cleanup
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/components/Histogram.tsx9
1 files changed, 7 insertions, 2 deletions
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) {