Skip to content

Commit 6aff30b

Browse files
committed
Fix - TGraph bar width should be at least 1 pixel
1 parent d536a53 commit 6aff30b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/hist2d/TGraphPainter.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,16 +669,17 @@ class TGraphPainter extends ObjectPainter {
669669

670670
if (main_block) {
671671
const fp = this.getFramePainter(),
672-
fpcol = fp?.fillatt && !fp?.fillatt.empty() ? fp.fillatt.getFillColor() : -1;
672+
fpcol = !fp?.fillatt?.empty() ? fp.fillatt.getFillColor() : -1;
673+
673674
if (fpcol === fillatt.getFillColor())
674675
usefill = new TAttFillHandler({ color: fpcol === 'white' ? 1 : 0, pattern: 1001 });
675676
}
676677

677678
nodes.append('svg:path')
678679
.attr('d', d => {
679680
d.bar = true; // element drawn as bar
680-
const dx = Math.round(-d.width/2),
681-
dw = Math.round(d.width),
681+
const dx = d.width > 1 ? Math.round(-d.width/2) : 0,
682+
dw = d.width > 1 ? Math.round(d.width) : 1,
682683
dy = (options.Bar !== 1) ? 0 : ((d.gry1 > yy0) ? yy0-d.gry1 : 0),
683684
dh = (options.Bar !== 1) ? (h > d.gry1 ? h - d.gry1 : 0) : Math.abs(yy0 - d.gry1);
684685
return `M${dx},${dy}h${dw}v${dh}h${-dw}z`;

0 commit comments

Comments
 (0)