Skip to content

Commit a115563

Browse files
committed
Fix problem with irregular axis labels
1 parent 8852858 commit a115563

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/gpad/TAxisPainter.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,9 @@ class TAxisPainter extends ObjectPainter {
558558
formatLabels(d) {
559559
let indx = parseFloat(d), a = this.getObject();
560560
if (!this.regular_labels)
561-
indx = (indx - a.fXmin)/(a.fXmax - a.fXmin) * a.fNbins;
562-
indx = Math.floor(indx);
561+
indx = Math.round((indx - a.fXmin)/(a.fXmax - a.fXmin) * a.fNbins);
562+
else
563+
indx = Math.floor(indx);
563564
if ((indx < 0) || (indx >= a.fNbins)) return null;
564565
for (let i = 0; i < a.fLabels.arr.length; ++i) {
565566
let tstr = a.fLabels.arr[i];

0 commit comments

Comments
 (0)