aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/Histogram.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/Histogram.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/Histogram.tsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
index efe17297b..1077df844 100644
--- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx
+++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx
@@ -267,10 +267,10 @@ export class Histogram extends React.Component<HistogramProps> {
var histogram = d3.histogram()
.value(function(d) {return d})
.domain([startingPoint!, endingPoint!])
- .thresholds(x.ticks(numBins-1))
+ .thresholds(x.ticks(numBins))
var bins = histogram(data)
var eachRectWidth = width/(bins.length)
- var graphStartingPoint = bins[0].x1? bins[0].x1! - (bins[1].x1! - bins[1].x0!) : 0;
+ var graphStartingPoint = (bins[0].x1 && bins[1])? bins[0].x1! - (bins[1].x1! - bins[1].x0!) : 0;
bins[0].x0 = graphStartingPoint;
x = x.domain([graphStartingPoint, endingPoint])
.range([0, Number.isInteger(this.rangeVals.xMin!)? (width-eachRectWidth) : width ])
@@ -286,7 +286,7 @@ export class Histogram extends React.Component<HistogramProps> {
index = j;
}
}
- bins[index].push(data[i])
+ if (bins[index]) bins[index].push(data[i])
}
bins.pop();
eachRectWidth = width/(bins.length)