Skip to content

Commit 4294bc5

Browse files
committed
Edit graph title
1 parent 503d945 commit 4294bc5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

modules/hist2d/TGraphPainter.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,15 +1392,25 @@ class TGraphPainter extends ObjectPainter {
13921392
fillContextMenuItems(menu) {
13931393
if (!this.snapid) {
13941394
menu.addchk(this.testEditable(), 'Editable', () => { this.testEditable('toggle'); this.drawGraph(); });
1395-
1395+
if (this.axes_draw) {
1396+
menu.add('Title', () => menu.input('Enter graph title', this.getObject().fTitle).then(res => {
1397+
this.getObject().fTitle = res;
1398+
const hist_painter = this.getMainPainter();
1399+
if (hist_painter?.isSecondary(this)) {
1400+
setHistogramTitle(hist_painter.getHisto(), res);
1401+
this.interactiveRedraw('pad');
1402+
}
1403+
}));
1404+
}
13961405
menu.addRedrawMenu(this.getPrimary());
13971406
}
13981407
}
13991408

14001409
/** @summary Execute menu command
14011410
* @private */
14021411
executeMenuCommand(method, args) {
1403-
if (super.executeMenuCommand(method, args)) return true;
1412+
if (super.executeMenuCommand(method, args))
1413+
return true;
14041414

14051415
const canp = this.getCanvPainter(), pmain = this.get_main();
14061416

0 commit comments

Comments
 (0)