aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/components/Histogram.tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
index f9410a580..e4267aee3 100644
--- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx
+++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
@@ -278,17 +278,17 @@ export class Histogram extends React.Component<HistogramProps> {
.domain([0, numBins])
.range([0, width]);
}
-
+
var histogram = d3.histogram()
.value(function(d) {return d})
.domain([startingPoint!, endingPoint!])
- .thresholds(x.ticks(numBins))
+ .thresholds(x.ticks(numBins-1))
var bins = histogram(data)
- var eachRectWidth = width/(bins.length+1)
+ var eachRectWidth = width/(bins.length)
var graphStartingPoint = bins[0].x1! - (bins[1].x1! - bins[1].x0!)
bins[0].x0 = graphStartingPoint;
x = x.domain([graphStartingPoint, endingPoint])
- .range([0, width - eachRectWidth])
+ .range([0, Number.isInteger(this.rangeVals.xMin!)? (width-eachRectWidth) : width ])
var xAxis;
if (!this.numericalData) { // if the data is strings rather than numbers
@@ -345,7 +345,6 @@ export class Histogram extends React.Component<HistogramProps> {
.data(bins)
.enter()
.append("rect")
- .attr("x", 1)
.attr("transform", function(d) { return "translate(" + x(d.x0!) + "," + y(d.length) + ")"; })
.attr("width", eachRectWidth)
.attr("height", function(d) { return height - y(d.length); })