Skip to content

Commit 96e90f1

Browse files
committed
Fix - also correctly align legend header
1 parent cafd2f6 commit 96e90f1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎modules/hist/TPavePainter.mjs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -982,17 +982,19 @@ class TPavePainter extends ObjectPainter {
982982
.call(painter.lineatt.func);
983983
}
984984

985-
let pos_x = tpos_x;
985+
let pos_x = tpos_x, arg_width = Math.round(column_pos[icol + 1] - pos_x);
986986
if (isStr(lopt) && (lopt.toLowerCase() !== 'h'))
987987
any_opt = true;
988-
else if (!any_opt)
989-
pos_x = x0;
988+
else if (!any_opt) {
989+
pos_x = padding_x;
990+
arg_width = w - 2 * padding_x;
991+
}
990992

991993
if (entry.fLabel) {
992994
const textatt = this.createAttText({ attr: entry, std: false, attr_alt: legend }),
993995
arg = {
994996
draw_g: this.getG(), align: textatt.align,
995-
x: pos_x, width: Math.round(column_pos[icol + 1] - pos_x),
997+
x: pos_x, width: arg_width,
996998
y: y0, height: Math.round(row_height),
997999
scale: (custom_textg && !entry.fTextSize) || !legend.fTextSize,
9981000
text: entry.fLabel, color: textatt.color

0 commit comments

Comments
 (0)