Skip to content

Commit 22bc840

Browse files
committed
Adjust context menu for V axis
Labels are not used, but log bits can be important
1 parent d35f87c commit 22bc840

2 files changed

Lines changed: 44 additions & 33 deletions

File tree

modules/gui/menu.mjs

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -740,38 +740,40 @@ class JSRootMenu {
740740
faxis.fNdivisions = val; painter.interactiveRedraw('pad', `exec:SetNdivisions(${val})`, kind);
741741
}));
742742

743-
this.sub('Labels');
744-
this.addchk(faxis.TestBit(EAxisBits.kCenterLabels), 'Center',
745-
arg => { faxis.SetBit(EAxisBits.kCenterLabels, arg); painter.interactiveRedraw('pad', `exec:CenterLabels(${arg})`, kind); });
746-
this.addchk(faxis.TestBit(EAxisBits.kLabelsVert), 'Rotate',
747-
arg => { faxis.SetBit(EAxisBits.kLabelsVert, arg); painter.interactiveRedraw('pad', `exec:SetBit(TAxis::kLabelsVert,${arg})`, kind); });
748-
this.addColorMenu('Color', faxis.fLabelColor,
749-
arg => { faxis.fLabelColor = arg; painter.interactiveRedraw('pad', getColorExec(arg, 'SetLabelColor'), kind); });
750-
this.addSizeMenu('Offset', -0.02, 0.1, 0.01, faxis.fLabelOffset,
751-
arg => { faxis.fLabelOffset = arg; painter.interactiveRedraw('pad', `exec:SetLabelOffset(${arg})`, kind); });
752-
let a = faxis.fLabelSize >= 1;
753-
this.addSizeMenu('Size', a ? 2 : 0.02, a ? 30 : 0.11, a ? 2 : 0.01, faxis.fLabelSize,
754-
arg => { faxis.fLabelSize = arg; painter.interactiveRedraw('pad', `exec:SetLabelSize(${arg})`, kind); });
755-
756-
if (frame_painter && (axis_painter?.kind === kAxisLabels) && (faxis.fNbins > 20)) {
757-
this.add('Find label', () => this.input('Label id').then(id => {
758-
if (!id)
759-
return;
760-
for (let bin = 0; bin < faxis.fNbins; ++bin) {
761-
const lbl = axis_painter.formatLabels(bin);
762-
if (lbl === id)
763-
return frame_painter.zoomSingle(kind, Math.max(0, bin - 4), Math.min(faxis.fNbins, bin + 5));
764-
}
765-
}), 'Zoom into region around specific label');
766-
}
767-
if (frame_painter && faxis.fLabels) {
768-
const ignore = `${kind}_ignore_labels`;
769-
this.addchk(!frame_painter[ignore], 'Custom', flag => {
770-
frame_painter[ignore] = !flag;
771-
painter.interactiveRedraw('pad');
772-
}, `Use of custom labels in axis ${kind}`);
743+
if (kind !== 'v') {
744+
this.sub('Labels');
745+
this.addchk(faxis.TestBit(EAxisBits.kCenterLabels), 'Center',
746+
arg => { faxis.SetBit(EAxisBits.kCenterLabels, arg); painter.interactiveRedraw('pad', `exec:CenterLabels(${arg})`, kind); });
747+
this.addchk(faxis.TestBit(EAxisBits.kLabelsVert), 'Rotate',
748+
arg => { faxis.SetBit(EAxisBits.kLabelsVert, arg); painter.interactiveRedraw('pad', `exec:SetBit(TAxis::kLabelsVert,${arg})`, kind); });
749+
this.addColorMenu('Color', faxis.fLabelColor,
750+
arg => { faxis.fLabelColor = arg; painter.interactiveRedraw('pad', getColorExec(arg, 'SetLabelColor'), kind); });
751+
this.addSizeMenu('Offset', -0.02, 0.1, 0.01, faxis.fLabelOffset,
752+
arg => { faxis.fLabelOffset = arg; painter.interactiveRedraw('pad', `exec:SetLabelOffset(${arg})`, kind); });
753+
const a = faxis.fLabelSize >= 1;
754+
this.addSizeMenu('Size', a ? 2 : 0.02, a ? 30 : 0.11, a ? 2 : 0.01, faxis.fLabelSize,
755+
arg => { faxis.fLabelSize = arg; painter.interactiveRedraw('pad', `exec:SetLabelSize(${arg})`, kind); });
756+
757+
if (frame_painter && (axis_painter?.kind === kAxisLabels) && (faxis.fNbins > 20)) {
758+
this.add('Find label', () => this.input('Label id').then(id => {
759+
if (!id)
760+
return;
761+
for (let bin = 0; bin < faxis.fNbins; ++bin) {
762+
const lbl = axis_painter.formatLabels(bin);
763+
if (lbl === id)
764+
return frame_painter.zoomSingle(kind, Math.max(0, bin - 4), Math.min(faxis.fNbins, bin + 5));
765+
}
766+
}), 'Zoom into region around specific label');
767+
}
768+
if (frame_painter && faxis.fLabels) {
769+
const ignore = `${kind}_ignore_labels`;
770+
this.addchk(!frame_painter[ignore], 'Custom', flag => {
771+
frame_painter[ignore] = !flag;
772+
painter.interactiveRedraw('pad');
773+
}, `Use of custom labels in axis ${kind}`);
774+
}
775+
this.endsub();
773776
}
774-
this.endsub();
775777

776778
this.sub('Title');
777779
this.add('SetTitle', () => {
@@ -798,8 +800,8 @@ class JSRootMenu {
798800
});
799801
this.addSizeMenu('Offset', 0, 3, 0.2, faxis.fTitleOffset,
800802
arg => { faxis.fTitleOffset = arg; painter.interactiveRedraw('pad', `exec:SetTitleOffset(${arg})`, kind); });
801-
a = faxis.fTitleSize >= 1;
802-
this.addSizeMenu('Size', a ? 2 : 0.02, a ? 30 : 0.11, a ? 2 : 0.01, faxis.fTitleSize,
803+
const p = faxis.fTitleSize >= 1;
804+
this.addSizeMenu('Size', p ? 2 : 0.02, p ? 30 : 0.11, p ? 2 : 0.01, faxis.fTitleSize,
803805
arg => { faxis.fTitleSize = arg; painter.interactiveRedraw('pad', `exec:SetTitleSize(${arg})`, kind); });
804806
this.endsub();
805807

modules/hist/TPavePainter.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,15 @@ class TPavePainter extends ObjectPainter {
15731573
this.interactiveRedraw('pad', 'log');
15741574
});
15751575

1576+
menu.addchk(faxis.TestBit(EAxisBits.kMoreLogLabels), 'More log', flag => {
1577+
faxis.SetBit(EAxisBits.kMoreLogLabels, flag);
1578+
this.interactiveRedraw('pad');
1579+
});
1580+
menu.addchk(faxis.TestBit(EAxisBits.kNoExponent), 'No exponent', flag => {
1581+
faxis.SetBit(EAxisBits.kNoExponent, flag);
1582+
this.interactiveRedraw('pad');
1583+
});
1584+
15761585
hist_painter.fillPaletteMenu(menu, false);
15771586

15781587
menu.addTAxisMenu(EAxisBits, hist_painter || this, faxis, 'v', this.z_handle, null);

0 commit comments

Comments
 (0)