462 fLabelOffset = 0.005;
468 fTitleSize = fLabelSize;
497 fGridLength = gridlength;
498 fLabelOffset = 0.005;
504 fTitleSize = fLabelSize;
523 fFunction = (
TF1*)
gROOT->GetFunction(funcname);
525 Error(
"TGaxis",
"calling constructor with an unknown function: %s", funcname);
529 fWmin = fFunction->GetXmin();
530 fWmax = fFunction->GetXmax();
532 fFunctionName= funcname;
536 fGridLength = gridlength;
537 fLabelOffset = 0.005;
543 fTitleSize = fLabelSize;
650 TGaxis *newaxis =
new TGaxis(xmin,ymin,xmax,ymax,wmin,wmax,ndiv,chopt,gridlength);
739 const char *where =
"PaintAxis";
749 Double_t phil, phi, sinphi, cosphi, asinphi, acosphi;
750 Double_t binLow = 0., binLow2 = 0., binLow3 = 0.;
751 Double_t binHigh = 0., binHigh2 = 0., binHigh3 = 0.;
752 Double_t binWidth = 0., binWidth2 = 0., binWidth3 = 0.;
763 xx0 = xx1 = yy0 = yy1 = 0;
764 Double_t xxmin, xxmax, yymin, yymax;
765 xxmin = xxmax = yymin = yymax = 0;
769 Double_t xmnlog, x00, x11, h2, h2sav, axmul,
y;
772 Int_t nlabels, nticks, nticks0, nticks1;
773 Int_t i, j, k,
l, decade, ltick;
777 Int_t iexe, if1, if2, na, nf, ih1, ih2, nbinin, nch, kmod;
778 Int_t optionLog,optionBlank,optionVert,optionPlus,optionMinus,optionUnlab,optionPara;
779 Int_t optionDown,optionRight,optionLeft,optionCent,optionEqual,optionDecimals=0,optionDot;
780 Int_t optionY,optionText,optionGrid,optionSize,optionNoopt,optionInt,optionM,optionUp,optionX;
783 Int_t xalign, yalign;
784 Int_t nn1, nn2, nn3, n1a, n2a, n3a, nb2, nb3;
811 chtemp = &kchtemp[0];
831 if(strchr(chopt,
'G')) optionLog = 1;
else optionLog = 0;
832 if(strchr(chopt,
'B')) optionBlank= 1;
else optionBlank= 0;
833 if(strchr(chopt,
'V')) optionVert = 1;
else optionVert = 0;
834 if(strchr(chopt,
'+')) optionPlus = 1;
else optionPlus = 0;
835 if(strchr(chopt,
'-')) optionMinus= 1;
else optionMinus= 0;
836 if(strchr(chopt,
'U')) optionUnlab= 1;
else optionUnlab= 0;
837 if(strchr(chopt,
'P')) optionPara = 1;
else optionPara = 0;
838 if(strchr(chopt,
'O')) optionDown = 1;
else optionDown = 0;
839 if(strchr(chopt,
'R')) optionRight= 1;
else optionRight= 0;
840 if(strchr(chopt,
'L')) optionLeft = 1;
else optionLeft = 0;
841 if(strchr(chopt,
'C')) optionCent = 1;
else optionCent = 0;
842 if(strchr(chopt,
'=')) optionEqual= 1;
else optionEqual= 0;
843 if(strchr(chopt,
'Y')) optionY = 1;
else optionY = 0;
844 if(strchr(chopt,
'T')) optionText = 1;
else optionText = 0;
845 if(strchr(chopt,
'W')) optionGrid = 1;
else optionGrid = 0;
846 if(strchr(chopt,
'S')) optionSize = 1;
else optionSize = 0;
847 if(strchr(chopt,
'N')) optionNoopt= 1;
else optionNoopt= 0;
848 if(strchr(chopt,
'I')) optionInt = 1;
else optionInt = 0;
849 if(strchr(chopt,
'M')) optionM = 1;
else optionM = 0;
850 if(strchr(chopt,
'0')) optionUp = 1;
else optionUp = 0;
851 if(strchr(chopt,
'X')) optionX = 1;
else optionX = 0;
852 if(strchr(chopt,
't')) optionTime = 1;
else optionTime = 0;
853 if(strchr(chopt,
'.')) optionDot = 1;
else optionDot = 0;
875 Error(where,
"Invalid number of divisions: %d",ndiv);
882 if (gridlength == 0) gridlength = 0.8;
883 linegrid =
new TLine();
913 Int_t year, mm, dd, hh, mi, ss;
914 if (sscanf(stringtimeoffset.
Data(),
"%d-%d-%d %d:%d:%d", &year, &mm, &dd, &hh, &mi, &ss) == 6) {
917 tp.tm_year = year-1900;
931 TString sdp = stringtimeoffset(ids+1,lns);
932 sscanf(sdp.
Data(),
"%g",&dp);
936 Error(where,
"Time offset has not the right format");
941 wmin += timeoffset - (int)(timeoffset);
942 wmax += timeoffset - (int)(timeoffset);
946 time_t timetp = (time_t)((
Long_t)(timeoffset));
949 if (range>60) rangeBase = 60*20;
950 if (range>3600) rangeBase = 3600*20;
951 if (range>86400) rangeBase = 86400*20;
952 if (range>2419200) rangeBase = 31556736;
954 if (range>31536000) {
955 tp0 = gmtime(&timetp);
962 rangeBase = (timetp-mktime(tp0));
963 rangeOffset = (
Double_t) (rangeBase);
971 n2a = (ndiv%10000 - n1a)/100;
984 if (wmin == wmax || ndiv == 0 || n1a <= 1 || optionLog) {
990 if ( (wmax-wmin) < 1 && optionInt) {
991 Error(where,
"option I not available");
994 if (!optionNoopt || optionInt ) {
1002 if (binLow !=
Double_t(
int(binLow)) || binWidth !=
Double_t(
int(binWidth))) {
1006 if ((wmin-binLow) > epsilon) { binLow += binWidth; nbins--; }
1007 if ((binHigh-wmax) > epsilon) { binHigh -= binWidth; nbins--; }
1009 rtyw = (ymax-
ymin)/(wmax-wmin);
1012 yymin = rtyw*(binLow-wmin) + ymin;
1013 yymax = rtyw*(binHigh-wmin) + ymin;
1016 rtxw = (xmax-
xmin)/(wmax-wmin);
1017 xxmin = rtxw*(binLow-wmin) + xmin;
1018 xxmax = rtxw*(binHigh-wmin) + xmin;
1024 alfa = (ymax-
ymin)/(xmax-xmin);
1025 beta = (ymin*xmax-ymax*
xmin)/(xmax-xmin);
1026 yymin = alfa*xxmin +
beta;
1027 yymax = alfa*xxmax +
beta;
1042 if (!optionNoopt && n2a > 1 && binWidth > 0) {
1048 if (!optionNoopt && n3a > 1 && binWidth2 > 0) {
1062 ratio1 = 1/(rwxmax-rwxmin);
1063 ratio2 = 1/(rwymax-rwymin);
1064 x0 = ratio1*(xmin-rwxmin);
1065 x1 = ratio1*(xmax-rwxmin);
1066 y0 = ratio2*(ymin-rwymin);
1067 y1 = ratio2*(ymax-rwymin);
1068 if (!optionNoopt || optionInt ) {
1069 xx0 = ratio1*(xxmin-rwxmin);
1070 xx1 = ratio1*(xxmax-rwxmin);
1071 yy0 = ratio2*(yymin-rwymin);
1072 yy1 = ratio2*(yymax-rwymin);
1075 if ((x0 == x1) && (y0 == y1)) {
1076 Error(where,
"length of axis is 0");
1083 if (toffset==0 && x1 == x0) autotoff =
kTRUE;
1098 if (!
gPad->IsBatch()) {
1099 gVirtualX->GetCharacterUp(chupxvsav, chupyvsav);
1104 axis_length =
TMath::Sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
1105 if (axis_length == 0) {
1106 Error(where,
"length of axis is 0");
1109 if (!optionNoopt || optionInt) {
1110 axis_lengthN =
TMath::Sqrt((xx1-xx0)*(xx1-xx0)+(yy1-yy0)*(yy1-yy0));
1111 axis_length0 =
TMath::Sqrt((xx0-x0)*(xx0-x0)+(yy0-y0)*(yy0-y0));
1112 axis_length1 =
TMath::Sqrt((x1-xx1)*(x1-xx1)+(y1-yy1)*(y1-yy1));
1113 if (axis_lengthN < epsilon) {
1122 wmin += timeoffset - (int)(timeoffset) + rangeOffset;
1123 wmax += timeoffset - (int)(timeoffset) + rangeOffset;
1129 if (y1>=y0) phi = 0.5*
kPI;
1145 if (acosphi <= epsilon) { acosphi = 0; cosphi = 0; }
1146 if (asinphi <= epsilon) { asinphi = 0; sinphi = 0; }
1154 if (x0 == x1 && y1 > y0) mside = -1;
1155 if (optionPlus) mside = 1;
1156 if (optionMinus) mside = -1;
1157 if (optionPlus && optionMinus) mside = 0;
1160 if (optionEqual) lside = mside;
1161 if (optionPlus && optionMinus) {
1163 if (optionEqual) lside=1;
1168 if(xmside >= 0) tick_side = 1;
1169 else tick_side = -1;
1170 if (optionSize) atick[0] = tick_side*axis_length*
fTickSize;
1171 else atick[0] = tick_side*axis_length*0.03;
1173 atick[1] = 0.5*atick[0];
1174 atick[2] = 0.5*atick[1];
1177 if ((x0 == x1) && (y1 > y0)) grid_side =-1;
1202 if (ndiv == 0)
goto L210;
1204 Error(where,
"wmin (%f) == wmax (%f)", wmin, wmax);
1214 if (optionText &&
GetLabelFont()%10 != 3) charheight *= 0.66666;
1224 if (!optionUp && !optionDown && !optionY && !optionUnlab) {
1225 if (!drawGridOnly && optionText && ((ymin == ymax) || (xmin == xmax))) {
1239 if (nl > 50) angle = 90;
1247 if (ymin ==
gPad->GetUymax()) {
1259 if (xmin ==
gPad->GetUxmax()) {
1276 ymin +(i-0.5)*(ymax-
ymin)/nl,
1286 if (!
gPad->IsBatch()) {
1287 if (cosphi > 0)
gVirtualX->SetCharacterUp(-sinphi,cosphi);
1288 else gVirtualX->SetCharacterUp(sinphi,-cosphi);
1289 if (x0 == x1)
gVirtualX->SetCharacterUp(0,1);
1290 if (optionVert)
gVirtualX->SetCharacterUp(0,1);
1291 if (optionPara)
gVirtualX->SetCharacterUp(-sinphi,cosphi);
1292 if (optionDown)
gVirtualX->SetCharacterUp(cosphi,sinphi);
1298 if (x0 == x1) xalign = 3;
1299 if (y0 != y1) yalign = 2;
1300 if (optionCent) xalign = 2;
1301 if (optionRight) xalign = 3;
1302 if (optionLeft) xalign = 1;
1306 if (cosphi*sinphi > 0) xalign = 1;
1307 if (cosphi*sinphi < 0) xalign = 3;
1313 if (optionPlus && !optionMinus) {
1318 if (lside < 0) ylabel += atick[0];
1320 }
else if (y0 == y1) {
1321 if (optionMinus && !optionPlus) {
1332 if (mside <= 0) ylabel -=
TMath::Abs(atick[0]);
1334 if (optionLog) ylabel -= 0.5*charheight;
1339 if (optionText) ylabel /= 2;
1345 dxtick=(binHigh-binLow)/
Double_t(nticks-1);
1347 if (optionNoopt && !optionInt) dxtick=axis_length/
Double_t(nticks-1);
1348 else dxtick=axis_lengthN/
Double_t(nticks-1);
1350 for (k=0;k<nticks; k++) {
1352 if (k%nn3 == 0) ltick = 1;
1353 if (k%nn2 == 0) ltick = 0;
1357 xtick = zz* axis_length /
TMath::Abs(rwma-rwmi);
1362 if (!mside) ytick -= atick[ltick];
1363 if ( optionNoopt && !optionInt) {
1364 Rotate(xtick,ytick,cosphi,sinphi,x0,y0,xpl2,ypl2);
1365 Rotate(xtick,atick[ltick],cosphi,sinphi,x0,y0,xpl1,ypl1);
1368 Rotate(xtick,ytick,cosphi,sinphi,xx0,yy0,xpl2,ypl2);
1369 Rotate(xtick,atick[ltick],cosphi,sinphi,xx0,yy0,xpl1,ypl1);
1372 if ((x0 != x1) && (y0 != y1)) {
1375 if (cosphi > 0) ypl1 = ypl2 + atick[ltick];
1376 else ypl1 = ypl2 - atick[ltick];
1379 xpl1 = 0.5*(xpl1 + xpl2);
1381 ypl1 = 0.5*(ypl1 + ypl2) + atick[ltick];
1382 ypl2 = 0.5*(ypl1 + ypl2) - atick[ltick];
1386 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1390 if (optionNoopt && !optionInt) {
1391 Rotate(xtick,0,cosphi,sinphi,x0,y0 ,xpl2,ypl2);
1392 Rotate(xtick,grid_side*gridlength ,cosphi,sinphi,x0,y0 ,xpl1,ypl1);
1395 Rotate(xtick,0,cosphi ,sinphi,xx0,yy0 ,xpl2,ypl2);
1396 Rotate(xtick,grid_side*gridlength ,cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1405 if (
fFunction) axis_length0 = binLow-wmin;
1406 if ((!optionNoopt || optionInt) && axis_length0) {
1407 nticks0 =
Int_t(axis_length0/dxtick);
1408 if (nticks0 > 1000) nticks0 = 1000;
1409 for (k=0; k<=nticks0; k++) {
1411 if (k%nn3 == 0) ltick = 1;
1412 if (k%nn2 == 0) ltick = 0;
1414 if (!mside) ytick0 -= atick[ltick];
1419 Rotate(xtick0,ytick0,cosphi,sinphi,xx0,yy0 ,xpl2,ypl2);
1420 Rotate(xtick0,atick[ltick],cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1422 if ((x0 != x1) && (y0 != y1)) {
1425 if (cosphi > 0) ypl1 = ypl2 + atick[ltick];
1426 else ypl1 = ypl2 - atick[ltick];
1429 xpl1 = 0.5*(xpl1 + xpl2);
1431 ypl1 = 0.5*(ypl1 + ypl2) + atick[ltick];
1432 ypl2 = 0.5*(ypl1 + ypl2) - atick[ltick];
1436 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1440 Rotate(xtick0,0,cosphi,sinphi,xx0,yy0,xpl2,ypl2);
1441 Rotate(xtick0,grid_side*gridlength ,cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1449 if (
fFunction) axis_length1 = wmax-binHigh;
1450 if ((!optionNoopt || optionInt) && axis_length1) {
1451 nticks1 = int(axis_length1/dxtick);
1452 if (nticks1 > 1000) nticks1 = 1000;
1453 for (k=0; k<=nticks1; k++) {
1455 if (k%nn3 == 0) ltick = 1;
1456 if (k%nn2 == 0) ltick = 0;
1458 if (!mside) ytick1 -= atick[ltick];
1463 Rotate(xtick1,ytick1,cosphi,sinphi,xx0,yy0 ,xpl2,ypl2);
1464 Rotate(xtick1,atick[ltick],cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1466 if ((x0 != x1) && (y0 != y1)) {
1469 if (cosphi > 0) ypl1 = ypl2 + atick[ltick];
1470 else ypl1 = ypl2 - atick[ltick];
1473 xpl1 = 0.5*(xpl1 + xpl2);
1475 ypl1 = 0.5*(ypl1 + ypl2) + atick[ltick];
1476 ypl2 = 0.5*(ypl1 + ypl2) - atick[ltick];
1480 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1483 Rotate(xtick1,0,cosphi,sinphi,xx0,yy0 ,xpl2,ypl2);
1484 Rotate(xtick1,grid_side*gridlength,cosphi,sinphi,xx0,yy0,xpl1,ypl1);
1495 if (!drawGridOnly && !optionUnlab) {
1499 if ((wmin == wmax) || (ndiv == 0)) {
1500 Error(where,
"wmin (%f) == wmax (%f), or ndiv == 0", wmin, wmax);
1504 dwlabel = (wmax-wmin)/
Double_t(n1a);
1505 if (optionNoopt && !optionInt) dxlabel = axis_length/
Double_t(n1a);
1506 else dxlabel = axis_lengthN/
Double_t(n1a);
1508 if (!optionText && !optionTime) {
1530 if (iexe%3 == 1) iexe += 2;
1531 else if(iexe%3 == 2) iexe += 1;
1532 if (nexe < 0) nexe = -iexe;
1545 if (!noExponent && nf > maxDigits) flexpo =
kTRUE;
1546 if (!noExponent && nf < -maxDigits) flexne =
kTRUE;
1557 if (nexe%3 == 0 && ww <=
TMath::Power(10,maxDigits-1))
break;
1569 if (nexe%3 == 0 && ww >= rne)
break;
1574 for (i=maxDigits-1; i>0; i--) {
1580 if (wdyn <= 0.999 && na < maxDigits-2) {
1600 coded = &chcoded[0];
1601 if (if1 > 14) if1=14;
1602 if (if2 > 14) if2=14;
1603 if (if2>0)
snprintf(coded,8,
"%%%d.%df",if1,if2);
1605 if (if1 < -100) if1 = -100;
1606 snprintf(coded,8,
"%%%d.%df",if1+1,1);
1614 Int_t ndecimals = 0;
1615 if (optionDecimals) {
1616 char *dot = strchr(chtemp,
'.');
1618 ndecimals = chtemp + strlen(chtemp) -dot;
1621 exp = strstr(chtemp,
"e-");
1623 sscanf(&exp[2],
"%d",&ndecimals);
1628 if (optionM) nlabels = n1a-1;
1631 for ( k=0; k<=nlabels; k++) {
1636 xlabel = zz* axis_length /
TMath::Abs(rwma-rwmi);
1640 if (optionM) xlabel += 0.5*dxlabel;
1642 if (!optionText && !optionTime) {
1643 snprintf(label,256,&chcoded[0],wlabel);
1649 if (label[first] ==
'.') {
1650 strncpy(chtemp,
"0",256);
1651 strlcat(chtemp, &label[first],256);
1652 strncpy(label, chtemp,256);
1653 first = 1; last = strlen(label);
1655 if (label[first] ==
'-' && label[first+1] ==
'.') {
1656 strncpy(chtemp,
"-0",256);
1657 strlcat(chtemp, &label[first+1],256);
1658 strncpy(label, chtemp, 256);
1659 first = 1; last = strlen(label);
1664 char *adot = strchr(label,
'.');
1665 if (adot) adot[ndecimals] = 0;
1667 while (label[last] ==
'0') { label[last] = 0; last--;}
1671 if (label[last] ==
'.') {
1672 if (!optionDot) { label[last] = 0; last--;}
1676 if (last-first == 1 && label[first] ==
'-' 1677 && label[last] ==
'0') {
1678 strncpy(label,
"0", 256);
1686 timed = wlabel + (int)(timeoffset) - rangeOffset;
1687 timelabel = (time_t)((
Long_t)(timed));
1688 if (optionTime == 1) {
1689 utctis = localtime(&timelabel);
1691 utctis = gmtime(&timelabel);
1694 if (timeformat.
Length() < 220) timeformattmp = timeformat;
1695 else timeformattmp =
"#splitline{Format}{too long}";
1701 snprintf(label, 256,
"%%S%7.5f", modf(timed,&tmpdb));
1702 tmplast = strlen(label)-1;
1705 while (label[tmplast] ==
'0') {
1706 label[tmplast] = 0; tmplast--;
1715 if (utctis !=
nullptr) {
1716 strftime(label, 256, timeformattmp.
Data(), utctis);
1718 strncpy(label,
"invalid", 256);
1720 strncpy(chtemp, &label[0], 256);
1721 first = 0; last=strlen(label)-1;
1722 wlabel = wTimeIni + (k+1)*dwlabel;
1727 if (optionNoopt && !optionInt)
1728 Rotate (xlabel,ylabel,cosphi,sinphi,x0,y0,xx,yy);
1729 else Rotate (xlabel,ylabel,cosphi,sinphi,xx0,yy0,xx,yy);
1730 if (y0 == y1 && !optionDown && !optionUp) {
1731 yy -= 0.80*charheight;
1734 if (x0 != x1 && y0 != y1) {
1735 if (optionNoopt && !optionInt)
1736 Rotate (xlabel,0,cosphi,sinphi,x0,y0,xx,yy);
1737 else Rotate (xlabel,0,cosphi,sinphi,xx0,yy0,xx,yy);
1738 if (cosphi > 0 ) yy += ylabel;
1739 if (cosphi < 0 ) yy -= ylabel;
1742 if (!optionY || (x0 == x1)) {
1744 if (first > last) strncpy(chtemp,
" ", 256);
1745 else strncpy(chtemp, &label[first], 256);
1748 if (!optionTime) typolabel.
ReplaceAll(
"-",
"#minus");
1771 if (!optionText) lnlen = last-first+1;
1773 if (k+1 > nhilab) lnlen = 0;
1775 for ( l=1; l<=lnlen; l++) {
1776 if (!optionText) *chtemp = label[first+l-2];
1778 if (lnlen == 0) strncpy(chtemp,
" ", 256);
1779 else strncpy(chtemp,
"1", 256);
1788 yy -= charheight*1.3;
1795 if (flexe && !optionText && nexe) {
1796 snprintf(label,256,
"#times10^{%d}", nexe);
1797 if (x0 != x1) { xfactor = axis_length+0.1*charheight; yfactor = 0; }
1798 else { xfactor = y1-y0+0.1*charheight; yfactor = 0; }
1799 Rotate (xfactor,yfactor,cosphi,sinphi,x0,y0,xx,yy);
1825 if (optionLog && ndiv) {
1826 UInt_t xi1=0,xi2=0,wi=0,yi1=0,yi2=0,
hi=0,xl=0,xh=0;
1828 if ((wmin == wmax) || (ndiv == 0)) {
1829 Error(where,
"wmin (%f) == wmax (%f), or ndiv == 0", wmin, wmax);
1833 Error(where,
"negative logarithmic axis");
1837 Error(where,
"negative logarithmic axis");
1841 if (xmnlog > 0) xmnlog += 1.E-6;
1842 else xmnlog -= 1.E-6;
1847 if (h2 > 0) h2 += 1.E-6;
1852 axmul = (x11-x00)/(h2sav-xmnlog);
1857 if ( xmnlog > 0 && (xmnlog-
Double_t(ih1) > 0) ) labelnumber++;
1858 Int_t changelablogid = 0;
1859 Int_t changelablognum = 0;
1860 for (j=1; j<=nbinin; j++) {
1865 if (x0 == x1 && j == 1) ylabel += charheight*0.33;
1866 if (y0 == y1 && j == 1) ylabel -= charheight*0.65;
1867 xone = x00+axmul*(
Double_t(decade)-xmnlog);
1869 if (j < 0) printf(
"j=%d\n",j);
1870 if (x00 > xone)
goto L160;
1871 if ((xone-x11)>epsilon)
break;
1874 if (!mside) y -= atick[0];
1875 Rotate(xone,y,cosphi,sinphi,x0,y0,xpl2,ypl2);
1876 Rotate(xtwo,atick[0],cosphi,sinphi,x0,y0,xpl1,ypl1);
1878 if ((x0 != x1) && (y0 != y1)) {
1881 if (cosphi > 0) ypl1 = ypl2 + atick[0];
1882 else ypl1 = ypl2 - atick[0];
1885 xpl1 = 0.5*(xpl1 + xpl2);
1887 ypl1 = 0.5*(ypl1 + ypl2) + atick[0];
1888 ypl2 = 0.5*(ypl1 + ypl2) - atick[0];
1892 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1895 Rotate(xone,0,cosphi,sinphi,x0,y0,xpl2,ypl2);
1896 Rotate(xone,grid_side*gridlength,cosphi,sinphi,x0,y0,xpl1,ypl1);
1900 if (!drawGridOnly && !optionUnlab) {
1907 while (last > first) {
1908 if (label[last] !=
'0')
break;
1912 if (label[last] ==
'.') {label[last] = 0; last--;}
1914 snprintf(label,256,
"%d", labelnumber);
1917 Rotate (xone,ylabel,cosphi,sinphi,x0,y0,xx,yy);
1918 if ((x0 == x1) && !optionPara) {
1921 if (labelnumber == 0) nch=1;
1923 xx += nch*charheight;
1925 xx += 0.25*charheight;
1928 xx += 0.25*charheight;
1930 if ((y0 == y1) && !optionDown && !optionUp) {
1931 if (noExponent) yy += 0.33*charheight;
1933 if (n1a == 0)
goto L210;
1935 if (kmod == 0) kmod=1000000;
1936 if ((nbinin <= n1a) || (j == 1) || (j == nbinin) || ((nbinin > n1a) && (j%kmod == 0))) {
1937 if (labelnumber == 0) {
1939 }
else if (labelnumber == 1) {
1943 chtemp = &label[first];
1945 snprintf(chtemp,256,
"10^{%d}", labelnumber);
1949 if (changelablogid == 0) changelablognum = nbinin-j;
1969 for (k=2;k<10;k++) {
1973 if (x00 > xone)
continue;
1974 if (xone > x11)
goto L200;
1976 if (!mside) y -= atick[1];
1978 Rotate(xone,y,cosphi,sinphi,x0,y0,xpl2,ypl2);
1979 Rotate(xtwo,atick[1],cosphi,sinphi,x0,y0,xpl1,ypl1);
1981 if ((x0 != x1) && (y0 != y1)) {
1984 if (cosphi > 0) ypl1 = ypl2 + atick[1];
1985 else ypl1 = ypl2 - atick[1];
1988 xpl1 = 0.5*(xpl1+xpl2);
1990 ypl1 = 0.5*(ypl1+ypl2) + atick[1];
1991 ypl2 = 0.5*(ypl1+ypl2) - atick[1];
1996 if ((nbinin <= idn) || ((nbinin > idn) && (k == 5))) {
1997 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
2001 if (moreLogLabels && !optionUnlab && !drawGridOnly && !overlap) {
2006 if (labelnumber-1 == 0) {
2008 }
else if (labelnumber-1 == 1) {
2011 snprintf(chtemp,256,
"%d#times10^{%d}", k, labelnumber-1);
2014 Rotate (xone,ylabel,cosphi,sinphi,x0,y0,xx,yy);
2015 if ((x0 == x1) && !optionPara) {
2018 if (labelnumber == 0) nch=1;
2020 xx += nch*charheight;
2022 if (labelnumber >= 0) xx += 0.25*charheight;
2023 else xx += 0.50*charheight;
2026 xx += 0.25*charheight;
2028 if ((y0 == y1) && !optionDown && !optionUp) {
2029 if (noExponent) yy += 0.33*charheight;
2032 if ((x0 != x1) && (y0 != y1)) {
2033 Rotate(xone,ylabel,cosphi,sinphi,x0,y0,xx,yy);
2034 if (cosphi > 0) yy += ylabel;
2043 xi1 =
gPad->XtoAbsPixel(u);
2044 yi1 =
gPad->YtoAbsPixel(v);
2050 xi2 =
gPad->XtoAbsPixel(u);
2051 yi2 =
gPad->YtoAbsPixel(v);
2054 if ((x0 == x1 && yi1-
hi <= yi2) || (y0 == y1 && xl+wi >= xh)){
2068 if (optionGrid && nbinin <= 5 && ndiv > 100) {
2069 Rotate(xone,0,cosphi,sinphi,x0,y0,xpl2, ypl2);
2070 Rotate(xone,grid_side*gridlength,cosphi,sinphi,x0,y0, xpl1,ypl1);
2081 if (!drawGridOnly && strlen(
GetTitle())) {
2085 charheight = charheight/
gPad->GetWh();
2089 if (toffset) ylabel = xlside*charheight+toffset;
2090 else ylabel = xlside*1.6*charheight;
2092 ylabel = xlside*1.6*charheight*toffset;
2095 ylabel = xlside*1.3*charheight*toffset;
2097 if (y1 == y0) ylabel = xlside*1.6*charheight*toffset;
2100 else axispos = axis_length;
2119 Rotate(axispos,ylabel,cosphi,sinphi,x0,y0,xpl1,ypl1);
2130 if (optionGrid)
delete linegrid;
2149 if (binWidth <= 1) { binWidth = 1; binLow = int(A1); }
2151 Int_t width = int(binWidth/5) + 1;
2153 binLow = int(A1/binWidth)*binWidth;
2159 for (
Int_t ic=0; ic<1000; ic++) {
2161 Int_t ibl = int(binLow/binWidth);
2162 if ( (rbl-ibl) == 0 || ic > width) { binLow -= 5;
break;}
2169 while (xb <= binHigh) {
2173 binHigh = xb - binWidth;
2181 last = strlen(label)-1;
2182 for (
Int_t i=0; i<=last; i++) {
2183 if (strchr(
"1234567890-+.", label[i]) ) { first = i;
return; }
2185 Error(
"LabelsLimits",
"attempt to draw a blank label");
2209 out<<
"gaxis = new TGaxis("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2 2211 out<<
" gaxis->SetLabelOffset("<<
GetLabelOffset()<<
");"<<std::endl;
2212 out<<
" gaxis->SetLabelSize("<<
GetLabelSize()<<
");"<<std::endl;
2213 out<<
" gaxis->SetTickSize("<<
GetTickSize()<<
");"<<std::endl;
2214 out<<
" gaxis->SetGridLength("<<
GetGridLength()<<
");"<<std::endl;
2215 out<<
" gaxis->SetTitleOffset("<<
GetTitleOffset()<<
");"<<std::endl;
2216 out<<
" gaxis->SetTitleSize("<<
GetTitleSize()<<
");"<<std::endl;
2217 out<<
" gaxis->SetTitleColor("<<
GetTextColor()<<
");"<<std::endl;
2218 out<<
" gaxis->SetTitleFont("<<
GetTextFont()<<
");"<<std::endl;
2221 out<<
" gaxis->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
2224 out<<
" gaxis->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
2230 out<<
" gaxis->SetLabelColor(ci);" << std::endl;
2232 out<<
" gaxis->SetLabelColor("<<
GetLabelColor()<<
");"<<std::endl;
2237 out<<
" gaxis->SetLineColor(ci);" << std::endl;
2239 out<<
" gaxis->SetLineColor("<<
GetLineColor()<<
");"<<std::endl;
2242 out<<
" gaxis->SetLineStyle("<<
GetLineStyle()<<
");"<<std::endl;
2245 out<<
" gaxis->SetLineWidth("<<
GetLineWidth()<<
");"<<std::endl;
2248 out<<
" gaxis->SetLabelFont("<<
GetLabelFont()<<
");"<<std::endl;
2251 out<<
" gaxis->SetMoreLogLabels();"<<std::endl;
2254 out<<
" gaxis->SetNoExponent();"<<std::endl;
2257 out<<
" gaxis->Draw();"<<std::endl;
2285 Error(
"SetFunction",
"unknown function: %s", funcname);
2384 if (labNum < 0) labNum = nlabels + labNum + 2;
2527 timeoff = (time_t)((
Long_t)(toffset));
2531 utctis = gmtime(&timeoff);
2533 if (utctis !=
nullptr) {
2534 strftime(tmp, 20,
"%Y-%m-%d %H:%M:%S",utctis);
2573 void TGaxis::Streamer(
TBuffer &R__b)
2583 TLine::Streamer(R__b);
2584 TAttText::Streamer(R__b);
2599 fName.Streamer(R__b);
static time_t MktimeFromUTC(tm_t *tmstruct)
Equivalent of standard routine "mktime" but using the assumption that tm struct is filled with UTC...
Int_t GetLabelFont() const
virtual const char * GetName() const
Returns name of object.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual Float_t GetTickLength() const
virtual void SetName(const char *name)
Change the name of the axis.
virtual void SetMoreLogLabels(Bool_t more=kTRUE)
Set the kMoreLogLabels bit flag.
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
const char * GetBinLabel(Int_t bin) const
Return label for bin.
void SetText(TString t="")
Set modified label text.
Int_t GetFirst() const
Return first bin on the axis i.e.
Double_t fX1
X of 1st point.
virtual Color_t GetTextColor() const
Return the text color.
Style_t GetGridStyle() const
virtual Float_t GetLabelOffset() const
virtual Short_t GetTextAlign() const
Return the text alignment.
static Int_t fgMaxDigits
! Number of digits above which the 10>N notation is used
TString & ReplaceAll(const TString &s1, const TString &s2)
R__EXTERN TStyle * gStyle
static void SetExponentOffset(Float_t xoff=0., Float_t yoff=0., Option_t *axis="xy")
Static function to set X and Y offset of the axis 10^n notation.
Bool_t TestBit(UInt_t f) const
virtual Color_t GetAxisColor() const
static void SaveColor(std::ostream &out, Int_t ci)
Save a color with index > 228 as a C++ statement(s) on output stream out.
Float_t GetLabelSize() const
virtual Float_t GetTextAngle() const
Return the text angle.
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
static function to compute reasonable axis limits
virtual void CenterLabels(Bool_t center=kTRUE)
If center = kTRUE axis labels are centered in the center of the bin.
TString fTimeFormat
Time format, ex: 09/12/99 12:34:00.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
TGaxis & operator=(const TGaxis &)
Assignment operator.
virtual void SetTitle(const char *title="")
Change the title of the axis.
virtual void ImportAxisAttributes(TAxis *axis)
Internal method to import TAxis attributes to this TGaxis.
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
Double_t fX2
X of 2nd point.
void SetFont(Int_t f=-1)
Set modified label font.
virtual Float_t GetLabelSize() const
TAxis * fAxis
! Pointer to original TAxis axis (if any)
void SetAlign(Int_t a=-1)
Set modified label alignment.
TString fChopt
Axis options.
Float_t fLabelOffset
Offset of label wrt axis.
Bool_t GetDecimals() const
virtual void DrawAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t wmin, Double_t wmax, Int_t ndiv=510, Option_t *chopt="", Double_t gridlength=0)
Draw this axis with new attributes.
virtual Width_t GetLineWidth() const
Return the line width.
void ChangeLabelAttributes(Int_t i, Int_t nlabels, TLatex *t, char *c)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
double beta(double x, double y)
Calculates the beta function.
Color_t GetGridColor() const
if object in a list can be deleted
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
static Double_t SavedTextSize
virtual Style_t GetTitleFont() const
void SetTitleSize(Float_t titlesize)
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
static Float_t fXAxisExpYOffset
! Exponent Y offset for the X axis
virtual Style_t GetLineStyle() const
Return the line style.
static const double x2[5]
virtual void PaintLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2)
Draw this line with new coordinates in NDC.
static Float_t fYAxisExpYOffset
! Exponent Y offset for the Y axis
virtual void SetText(Double_t x, Double_t y, const char *text)
TString fTitle
Axis title.
Float_t fGridLength
Length of the grid in NDC.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
virtual Float_t GetTextSize() const
Return the text size.
Int_t fNModLabs
Number of modified labels.
To draw Mathematical Formula.
THashList * GetLabels() const
Double_t Log10(Double_t x)
void SetOption(Option_t *option="")
To set axis options.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual const char * GetName() const
Returns name of object.
TString & Append(const char *cs)
std::vector< std::vector< double > > Data
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
void SetAngle(Double_t a=-1.)
Set modified label angle.
void SetColor(Int_t c=-1)
Set modified label color.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Double_t ATan2(Double_t, Double_t)
TList * GetModifiedLabels() const
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
virtual ~TGaxis()
TGaxis default destructor.
void Error(const char *location, const char *msgfmt,...)
virtual const char * GetTimeFormat() const
virtual Color_t GetLabelColor() const
void SetLabelSize(Float_t labelsize)
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
TList * fModLabs
List of modified labels.
Float_t GetGridLength() const
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Float_t fTextAngle
Text angle.
Style_t fLineStyle
Line style.
virtual void PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax, Double_t &wmin, Double_t &wmax, Int_t &ndiv, Option_t *chopt="", Double_t gridlength=0, Bool_t drawGridOnly=kFALSE)
Control function to draw an axis.
Int_t GetLast() const
Return last bin on the axis i.e.
const char * GetTitle() const
Returns title of object.
Double_t GetXsize()
Return size of the formula along X in pad coordinates.
Class to manage histogram axis.
static void SetMaxDigits(Int_t maxd=5)
Static function to set fgMaxDigits for axis.
void SetFunction(const char *funcname="")
Specify a function to map the axis values.
Double_t fY1
Y of 1st point.
Double_t fWmin
Lowest value on the axis.
virtual Font_t GetTextFont() const
Return the text font.
Color_t fLineColor
Line color.
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual Float_t GetTitleOffset() const
Width_t fLineWidth
Line width.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static Int_t SavedTextAlign
void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
void SetSize(Double_t s=-1.)
Set modified label size.
virtual Color_t GetTitleColor() const
Font_t fTextFont
Text font.
virtual Double_t GetXmin() const
TF1 * fFunction
! Pointer to function computing axis values
void SetLabNum(Int_t n=0)
Set modified label number.
static Float_t fYAxisExpXOffset
! Exponent X offset for the Y axis
virtual Color_t GetLineColor() const
Return the line color.
void ResetLabelAttributes(TLatex *t)
Reset the label attributes to the value they have before the last call to ChangeLabelAttributes.
TString & Remove(Ssiz_t pos)
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Int_t fLabelFont
Font for labels.
virtual void AdjustBinSize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth)
Internal method for axis labels optimisation.
void SetLabelOffset(Float_t labeloffset)
static const double x1[5]
virtual void SetDecimals(Bool_t dot=kTRUE)
Set the decimals flag.
TAxis helper class used to store the modified labels.
Float_t fTitleOffset
Offset of title wrt axis.
static RooMathCoreReg dummy
TString fFunctionName
Name of mapping function pointed by fFunction.
virtual const char * GetTitle() const
Returns title of object.
virtual Double_t GetXmax() const
void SetLabelFont(Int_t labelfont)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual Float_t GetTitleSize() const
Float_t fTextSize
Text size.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
static Int_t GetMaxDigits()
Static function returning fgMaxDigits (See SetMaxDigits).
Binding & operator=(OUT(*fun)(void))
Mother of all ROOT objects.
TGaxis()
TGaxis default constructor.
virtual void Paint(Option_t *chopt="")
Draw this axis with its current attributes.
Float_t GetTitleOffset() const
virtual void Rotate(Double_t X, Double_t Y, Double_t CFI, Double_t SFI, Double_t XT, Double_t YT, Double_t &U, Double_t &V)
Internal method to rotate axis coordinates.
virtual void Add(TObject *obj)
static Int_t SavedTextColor
Float_t fLabelSize
Size of labels in NDC.
Short_t Max(Short_t a, Short_t b)
static Int_t SavedTextFont
void SetTimeOffset(Double_t toffset, Option_t *option="local")
Change the time offset. If option = "gmt", set display mode to GMT.
void SetTickSize(Float_t ticksize)
Int_t fLabelColor
Color for labels.
Float_t GetLabelOffset() const
void SetLabelColor(Int_t labelcolor)
Double_t fY2
Y of 2nd point.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
float type_of_call hi(const int &, const int &)
static Double_t SavedTextAngle
Change the label attributes of label number i.
Width_t GetGridWidth() const
Double_t Sqrt(Double_t x)
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Float_t fTitleSize
Size of title in NDC.
virtual Int_t GetSize() const
void SetTitleOffset(Float_t titleoffset=1)
Double_t fWmax
Highest value on the axis.
Float_t GetTickSize() const
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Color_t fTextColor
Text color.
Int_t GetStripDecimals() const
virtual void SetNoExponent(Bool_t noExponent=kTRUE)
Set the NoExponent flag.
virtual void CenterTitle(Bool_t center=kTRUE)
If center = kTRUE axis title will be centered. The default is right adjusted.
Float_t fTickSize
Size of primary tick mark in NDC.
static Float_t fXAxisExpXOffset
! Exponent X offset for the X axis
virtual Style_t GetLabelFont() const
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
void LabelsLimits(const char *label, Int_t &first, Int_t &last)
Internal method to find first and last character of a label.
TLine()
Line default constructor.
Int_t GetLabelColor() const
Int_t fNdiv
Number of divisions.
Short_t fTextAlign
Text alignment.
void ChangeLabel(Int_t labNum=0, Double_t labAngle=-1., Double_t labSize=-1., Int_t labAlign=-1, Int_t labColor=-1, Int_t labFont=-1, TString labText="")
Define new text attributes for the label number "labNum".
Float_t GetTitleSize() const
const char * Data() const
Double_t GetTimeOffset() const