Skip to content

Commit d7581b2

Browse files
committed
Fix - also correctly align legend header
1 parent eaf7930 commit d7581b2

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
@@ -969,17 +969,19 @@ class TPavePainter extends ObjectPainter {
969969
.call(painter.lineatt.func);
970970
}
971971

972-
let pos_x = tpos_x;
972+
let pos_x = tpos_x, arg_width = Math.round(column_pos[icol + 1] - pos_x);
973973
if (isStr(lopt) && (lopt.toLowerCase() !== 'h'))
974974
any_opt = true;
975-
else if (!any_opt)
976-
pos_x = x0;
975+
else if (!any_opt) {
976+
pos_x = padding_x;
977+
arg_width = w - 2 * padding_x;
978+
}
977979

978980
if (entry.fLabel) {
979981
const textatt = this.createAttText({ attr: entry, std: false, attr_alt: legend }),
980982
arg = {
981983
draw_g: this.getG(), align: textatt.align,
982-
x: pos_x, width: Math.round(column_pos[icol + 1] - pos_x),
984+
x: pos_x, width: arg_width,
983985
y: y0, height: Math.round(row_height),
984986
scale: (custom_textg && !entry.fTextSize) || !legend.fTextSize,
985987
text: entry.fLabel, color: textatt.color

0 commit comments

Comments
 (0)