Skip to content

Commit cd816d4

Browse files
committed
Fix - protect against patalogic case of 1-bin histogram
1 parent 27a0fff commit cd816d4

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Changes in 4.4.x
44
1. Fix - wrong selection of TH1 Y axis range when errors are displayed (#44)
55
2. Fix - apply user range for TH1 X-axis zooming (#44)
6+
3. Fix - protect against patalogic case of 1-bin histogram
67

78

89
## Changes in 4.4.2

scripts/JSRootPainter.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5990,8 +5990,9 @@
59905990

59915991
grx = Math.round(pmain.grx(x));
59925992

5993-
if (i === right) {
5994-
lastbin = true;
5993+
lastbin = (i === right);
5994+
5995+
if (lastbin && (left < right)) {
59955996
gry = curry;
59965997
} else {
59975998
y = this.histo.getBinContent(i+1);
@@ -6085,7 +6086,7 @@
60856086
}
60866087
}
60876088

6088-
if (this.fillatt.color !== 'none') {
6089+
if ((this.fillatt.color !== 'none') && (res.length > 0)) {
60896090
res+="L"+currx+","+(height+3);
60906091
res+="L"+startx+","+(height+3);
60916092
res+="Z";
@@ -6117,11 +6118,12 @@
61176118
return;
61186119
}
61196120

6120-
this.draw_g.append("svg:path")
6121-
.attr("d", res)
6122-
.style("stroke-linejoin","miter")
6123-
.call(this.lineatt.func)
6124-
.call(this.fillatt.func);
6121+
if (res.length > 0)
6122+
this.draw_g.append("svg:path")
6123+
.attr("d", res)
6124+
.style("stroke-linejoin","miter")
6125+
.call(this.lineatt.func)
6126+
.call(this.fillatt.func);
61256127

61266128
if ((JSROOT.gStyle.Tooltip === 1) && (bins!==null))
61276129
this.draw_g.selectAll("rect")

0 commit comments

Comments
 (0)