Skip to content

Commit 5a3e9b8

Browse files
committed
Support setting the axes' title via the TF1 title using semicolons (e.g. "title;x;y")
1 parent bb6a2ee commit 5a3e9b8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/JSRootPainter.more.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@
10131013
var xmin = 0, xmax = 1, ymin = 0, ymax = 1,
10141014
bins = this.CreateBins(true);
10151015

1016-
if (bins!==null) {
1016+
if ((bins!==null) && (bins.length > 0)) {
10171017

10181018
xmin = xmax = bins[0].x;
10191019
ymin = ymax = bins[0].y;
@@ -1033,7 +1033,15 @@
10331033
tf1 = this.GetObject();
10341034

10351035
histo.fName = tf1.fName + "_hist";
1036-
histo.fTitle = tf1.fTitle;
1036+
if (tf1.fTitle.indexOf(';')!==0) {
1037+
var array = tf1.fTitle.split(';');
1038+
histo.fTitle = array[0];
1039+
if (array.length>1)
1040+
histo.fXaxis.fTitle = array[1];
1041+
if (array.length>2)
1042+
histo.fYaxis.fTitle = array[2];
1043+
}
1044+
else histo.fTitle = tf1.fTitle;
10371045

10381046
histo.fXaxis.fXmin = xmin;
10391047
histo.fXaxis.fXmax = xmax;

0 commit comments

Comments
 (0)