439 fLabelOffset = 0.005;
445 fTitleSize = fLabelSize;
470 fGridLength = gridlength;
471 fLabelOffset = 0.005;
477 fTitleSize = fLabelSize;
496 fFunction = (
TF1*)
gROOT->GetFunction(funcname);
498 Error(
"TGaxis",
"calling constructor with an unknown function: %s", funcname);
502 fWmin = fFunction->GetXmin();
503 fWmax = fFunction->GetXmax();
505 fFunctionName= funcname;
507 fGridLength = gridlength;
508 fLabelOffset = 0.005;
514 fTitleSize = fLabelSize;
530 fGridLength(ax.fGridLength),
531 fTickSize(ax.fTickSize),
532 fLabelOffset(ax.fLabelOffset),
533 fLabelSize(ax.fLabelSize),
534 fTitleOffset(ax.fTitleOffset),
535 fTitleSize(ax.fTitleSize),
537 fLabelColor(ax.fLabelColor),
538 fLabelFont(ax.fLabelFont),
542 fTimeFormat(ax.fTimeFormat),
543 fFunctionName(ax.fFunctionName),
544 fFunction(ax.fFunction),
617 TGaxis *newaxis =
new TGaxis(xmin,ymin,xmax,ymax,wmin,wmax,ndiv,chopt,gridlength);
706 const char *where =
"PaintAxis";
716 Double_t phil,
phi, sinphi, cosphi, asinphi, acosphi;
717 Double_t binLow = 0., binLow2 = 0., binLow3 = 0.;
718 Double_t binHigh = 0., binHigh2 = 0., binHigh3 = 0.;
719 Double_t binWidth = 0., binWidth2 = 0., binWidth3 = 0.;
730 xx0 = xx1 = yy0 = yy1 = 0;
731 Double_t xxmin, xxmax, yymin, yymax;
732 xxmin = xxmax = yymin = yymax = 0;
739 Int_t nlabels, nticks, nticks0, nticks1;
740 Int_t i, j, k,
l, decade, ltick;
744 Int_t iexe, if1, if2,
na, nf, ih1, ih2, nbinin, nch, kmod;
745 Int_t optionLog,optionBlank,optionVert,optionPlus,optionMinus,optionUnlab,optionPara;
746 Int_t optionDown,optionRight,optionLeft,optionCent,optionEqual,optionDecimals=0,optionDot;
747 Int_t optionY,optionText,optionGrid,optionSize,optionNoopt,optionInt,optionM,optionUp,optionX;
750 Int_t xalign, yalign;
751 Int_t nn1, nn2, nn3, n1a, n2a, n3a, nb2, nb3;
778 chtemp = &kchtemp[0];
798 if(strchr(chopt,
'G')) optionLog = 1;
else optionLog = 0;
799 if(strchr(chopt,
'B')) optionBlank= 1;
else optionBlank= 0;
800 if(strchr(chopt,
'V')) optionVert = 1;
else optionVert = 0;
801 if(strchr(chopt,
'+')) optionPlus = 1;
else optionPlus = 0;
802 if(strchr(chopt,
'-')) optionMinus= 1;
else optionMinus= 0;
803 if(strchr(chopt,
'U')) optionUnlab= 1;
else optionUnlab= 0;
804 if(strchr(chopt,
'P')) optionPara = 1;
else optionPara = 0;
805 if(strchr(chopt,
'O')) optionDown = 1;
else optionDown = 0;
806 if(strchr(chopt,
'R')) optionRight= 1;
else optionRight= 0;
807 if(strchr(chopt,
'L')) optionLeft = 1;
else optionLeft = 0;
808 if(strchr(chopt,
'C')) optionCent = 1;
else optionCent = 0;
809 if(strchr(chopt,
'=')) optionEqual= 1;
else optionEqual= 0;
810 if(strchr(chopt,
'Y')) optionY = 1;
else optionY = 0;
811 if(strchr(chopt,
'T')) optionText = 1;
else optionText = 0;
812 if(strchr(chopt,
'W')) optionGrid = 1;
else optionGrid = 0;
813 if(strchr(chopt,
'S')) optionSize = 1;
else optionSize = 0;
814 if(strchr(chopt,
'N')) optionNoopt= 1;
else optionNoopt= 0;
815 if(strchr(chopt,
'I')) optionInt = 1;
else optionInt = 0;
816 if(strchr(chopt,
'M')) optionM = 1;
else optionM = 0;
817 if(strchr(chopt,
'0')) optionUp = 1;
else optionUp = 0;
818 if(strchr(chopt,
'X')) optionX = 1;
else optionX = 0;
819 if(strchr(chopt,
't')) optionTime = 1;
else optionTime = 0;
820 if(strchr(chopt,
'.')) optionDot = 1;
else optionDot = 0;
834 Error(where,
"Invalid number of divisions: %d",ndiv);
841 if (gridlength == 0) gridlength = 0.8;
842 linegrid =
new TLine();
872 Int_t year, mm, dd, hh, mi,
ss;
873 if (sscanf(stringtimeoffset.
Data(),
"%d-%d-%d %d:%d:%d", &year, &mm, &dd, &hh, &mi, &
ss) == 6) {
875 tp.tm_year = year-1900;
887 timeoffset = mktime(&tp);
901 TString sdp = stringtimeoffset(ids+1,lns);
902 sscanf(sdp.
Data(),
"%g",&dp);
906 Error(where,
"Time offset has not the right format");
911 wmin += timeoffset - (int)(timeoffset);
912 wmax += timeoffset - (int)(timeoffset);
916 time_t timetp = (time_t)((
Long_t)(timeoffset));
919 if (range>60) rangeBase = 60*20;
920 if (range>3600) rangeBase = 3600*20;
921 if (range>86400) rangeBase = 86400*20;
922 if (range>2419200) rangeBase = 31556736;
924 if (range>31536000) {
925 tp0 = gmtime(&timetp);
932 rangeBase = (timetp-mktime(tp0));
933 rangeOffset = (
Double_t) (rangeBase);
941 n2a = (ndiv%10000 - n1a)/100;
954 if (wmin == wmax || ndiv == 0 || n1a <= 1 || optionLog) {
960 if ( (wmax-wmin) < 1 && optionInt) {
961 Error(where,
"option I not available");
964 if (!optionNoopt || optionInt ) {
972 if (binLow !=
Double_t(
int(binLow)) || binWidth !=
Double_t(
int(binWidth))) {
976 if ((wmin-binLow) > epsilon) { binLow += binWidth; nbins--; }
977 if ((binHigh-wmax) > epsilon) { binHigh -= binWidth; nbins--; }
979 rtyw = (ymax-
ymin)/(wmax-wmin);
982 yymin = rtyw*(binLow-wmin) + ymin;
983 yymax = rtyw*(binHigh-wmin) + ymin;
986 rtxw = (xmax-
xmin)/(wmax-wmin);
987 xxmin = rtxw*(binLow-wmin) + xmin;
988 xxmax = rtxw*(binHigh-wmin) + xmin;
994 alfa = (ymax-
ymin)/(xmax-xmin);
995 beta = (ymin*xmax-ymax*
xmin)/(xmax-xmin);
996 yymin = alfa*xxmin +
beta;
997 yymax = alfa*xxmax +
beta;
1012 if (!optionNoopt && n2a > 1 && binWidth > 0) {
1018 if (!optionNoopt && n3a > 1 && binWidth2 > 0) {
1032 ratio1 = 1/(rwxmax-rwxmin);
1033 ratio2 = 1/(rwymax-rwymin);
1034 x0 = ratio1*(xmin-rwxmin);
1035 x1 = ratio1*(xmax-rwxmin);
1036 y0 = ratio2*(ymin-rwymin);
1037 y1 = ratio2*(ymax-rwymin);
1038 if (!optionNoopt || optionInt ) {
1039 xx0 = ratio1*(xxmin-rwxmin);
1040 xx1 = ratio1*(xxmax-rwxmin);
1041 yy0 = ratio2*(yymin-rwymin);
1042 yy1 = ratio2*(yymax-rwymin);
1045 if ((x0 == x1) && (y0 == y1)) {
1046 Error(where,
"length of axis is 0");
1063 if (!
gPad->IsBatch()) {
1064 gVirtualX->GetCharacterUp(chupxvsav, chupyvsav);
1069 axis_length =
TMath::Sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
1070 if (axis_length == 0) {
1071 Error(where,
"length of axis is 0");
1074 if (!optionNoopt || optionInt) {
1075 axis_lengthN =
TMath::Sqrt((xx1-xx0)*(xx1-xx0)+(yy1-yy0)*(yy1-yy0));
1076 axis_length0 =
TMath::Sqrt((xx0-x0)*(xx0-x0)+(yy0-y0)*(yy0-y0));
1077 axis_length1 =
TMath::Sqrt((x1-xx1)*(x1-xx1)+(y1-yy1)*(y1-yy1));
1078 if (axis_lengthN < epsilon) {
1087 wmin += timeoffset - (int)(timeoffset) + rangeOffset;
1088 wmax += timeoffset - (int)(timeoffset) + rangeOffset;
1109 if (acosphi <= epsilon) { acosphi = 0; cosphi = 0; }
1110 if (asinphi <= epsilon) { asinphi = 0; sinphi = 0; }
1118 if (x0 == x1 && y1 > y0) mside = -1;
1119 if (optionPlus) mside = 1;
1120 if (optionMinus) mside = -1;
1121 if (optionPlus && optionMinus) mside = 0;
1124 if (optionEqual) lside = mside;
1125 if (optionPlus && optionMinus) {
1127 if (optionEqual) lside=1;
1132 if(xmside >= 0) tick_side = 1;
1133 else tick_side = -1;
1134 if (optionSize) atick[0] = tick_side*axis_length*
fTickSize;
1135 else atick[0] = tick_side*axis_length*0.03;
1137 atick[1] = 0.5*atick[0];
1138 atick[2] = 0.5*atick[1];
1141 if ((x0 == x1) && (y1 > y0)) grid_side =-1;
1165 if (!drawGridOnly && strlen(
GetTitle())) {
1169 charheight = charheight/
gPad->GetWh();
1173 if (x1 == x0) ylabel = xlside*1.6*charheight*toffset;
1174 else ylabel = xlside*1.3*charheight*toffset;
1175 if (y1 == y0) ylabel = xlside*1.6*charheight*toffset;
1178 else axispos = axis_length;
1183 Rotate(axispos,ylabel,cosphi,sinphi,x0,y0,xpl1,ypl1);
1187 Rotate(axispos,ylabel,cosphi,sinphi,x0,y0,xpl1,ypl1);
1191 phil=(kPI+phil)*180/
kPI,
1198 Rotate(axispos,ylabel,cosphi,sinphi,x0,y0,xpl1,ypl1);
1202 Rotate(axispos,ylabel,cosphi,sinphi,x0,y0,xpl1,ypl1);
1214 if (ndiv == 0)
goto L210;
1216 Error(where,
"wmin (%f) == wmax (%f)", wmin, wmax);
1226 if (optionText &&
GetLabelFont()%10 != 3) charheight *= 0.66666;
1236 if (!optionUp && !optionDown && !optionY && !optionUnlab) {
1237 if (!drawGridOnly && optionText && ((ymin == ymax) || (xmin == xmax))) {
1251 if (nl > 50) angle = 90;
1259 if (ymin ==
gPad->GetUymax()) {
1271 if (xmin ==
gPad->GetUxmax()) {
1282 ymin +(i-0.5)*(ymax-
ymin)/nl,
1292 if (!
gPad->IsBatch()) {
1293 if (cosphi > 0)
gVirtualX->SetCharacterUp(-sinphi,cosphi);
1294 else gVirtualX->SetCharacterUp(sinphi,-cosphi);
1295 if (x0 == x1)
gVirtualX->SetCharacterUp(0,1);
1296 if (optionVert)
gVirtualX->SetCharacterUp(0,1);
1297 if (optionPara)
gVirtualX->SetCharacterUp(-sinphi,cosphi);
1298 if (optionDown)
gVirtualX->SetCharacterUp(cosphi,sinphi);
1304 if (x0 == x1) xalign = 3;
1305 if (y0 != y1) yalign = 2;
1306 if (optionCent) xalign = 2;
1307 if (optionRight) xalign = 3;
1308 if (optionLeft) xalign = 1;
1312 if (cosphi*sinphi > 0) xalign = 1;
1313 if (cosphi*sinphi < 0) xalign = 3;
1319 if (optionPlus && !optionMinus) {
1320 if (optionEqual) ylabel = fLabelOffset/2 + atick[0];
1324 if (lside < 0) ylabel += atick[0];
1326 }
else if (y0 == y1) {
1327 if (optionMinus && !optionPlus) {
1329 ylabel = fLabelOffset+0.5*
1330 ((
gPad->AbsPixeltoY(0)-
gPad->AbsPixeltoY((
Int_t)fLabelSize))/
1338 if (mside <= 0) ylabel -=
TMath::Abs(atick[0]);
1340 if (optionLog) ylabel -= 0.5*charheight;
1345 if (optionText) ylabel /= 2;
1351 dxtick=(binHigh-binLow)/
Double_t(nticks-1);
1353 if (optionNoopt && !optionInt) dxtick=axis_length/
Double_t(nticks-1);
1354 else dxtick=axis_lengthN/
Double_t(nticks-1);
1356 for (k=0;k<nticks; k++) {
1358 if (k%nn3 == 0) ltick = 1;
1359 if (k%nn2 == 0) ltick = 0;
1363 xtick = zz* axis_length /
TMath::Abs(rwma-rwmi);
1368 if (!mside) ytick -= atick[ltick];
1369 if ( optionNoopt && !optionInt) {
1370 Rotate(xtick,ytick,cosphi,sinphi,x0,y0,xpl2,ypl2);
1371 Rotate(xtick,atick[ltick],cosphi,sinphi,x0,y0,xpl1,ypl1);
1374 Rotate(xtick,ytick,cosphi,sinphi,xx0,yy0,xpl2,ypl2);
1375 Rotate(xtick,atick[ltick],cosphi,sinphi,xx0,yy0,xpl1,ypl1);
1378 if ((x0 != x1) && (y0 != y1)) {
1381 if (cosphi > 0) ypl1 = ypl2 + atick[ltick];
1382 else ypl1 = ypl2 - atick[ltick];
1385 xpl1 = 0.5*(xpl1 + xpl2);
1387 ypl1 = 0.5*(ypl1 + ypl2) + atick[ltick];
1388 ypl2 = 0.5*(ypl1 + ypl2) - atick[ltick];
1392 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1396 if (optionNoopt && !optionInt) {
1397 Rotate(xtick,0,cosphi,sinphi,x0,y0 ,xpl2,ypl2);
1398 Rotate(xtick,grid_side*gridlength ,cosphi,sinphi,x0,y0 ,xpl1,ypl1);
1401 Rotate(xtick,0,cosphi ,sinphi,xx0,yy0 ,xpl2,ypl2);
1402 Rotate(xtick,grid_side*gridlength ,cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1411 if (
fFunction) axis_length0 = binLow-wmin;
1412 if ((!optionNoopt || optionInt) && axis_length0) {
1413 nticks0 =
Int_t(axis_length0/dxtick);
1414 if (nticks0 > 1000) nticks0 = 1000;
1415 for (k=0; k<=nticks0; k++) {
1417 if (k%nn3 == 0) ltick = 1;
1418 if (k%nn2 == 0) ltick = 0;
1420 if (!mside) ytick0 -= atick[ltick];
1425 Rotate(xtick0,ytick0,cosphi,sinphi,xx0,yy0 ,xpl2,ypl2);
1426 Rotate(xtick0,atick[ltick],cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1428 if ((x0 != x1) && (y0 != y1)) {
1431 if (cosphi > 0) ypl1 = ypl2 + atick[ltick];
1432 else ypl1 = ypl2 - atick[ltick];
1435 xpl1 = 0.5*(xpl1 + xpl2);
1437 ypl1 = 0.5*(ypl1 + ypl2) + atick[ltick];
1438 ypl2 = 0.5*(ypl1 + ypl2) - atick[ltick];
1442 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1446 Rotate(xtick0,0,cosphi,sinphi,xx0,yy0,xpl2,ypl2);
1447 Rotate(xtick0,grid_side*gridlength ,cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1455 if (
fFunction) axis_length1 = wmax-binHigh;
1456 if ((!optionNoopt || optionInt) && axis_length1) {
1457 nticks1 = int(axis_length1/dxtick);
1458 if (nticks1 > 1000) nticks1 = 1000;
1459 for (k=0; k<=nticks1; k++) {
1461 if (k%nn3 == 0) ltick = 1;
1462 if (k%nn2 == 0) ltick = 0;
1464 if (!mside) ytick1 -= atick[ltick];
1469 Rotate(xtick1,ytick1,cosphi,sinphi,xx0,yy0 ,xpl2,ypl2);
1470 Rotate(xtick1,atick[ltick],cosphi,sinphi,xx0,yy0 ,xpl1,ypl1);
1472 if ((x0 != x1) && (y0 != y1)) {
1475 if (cosphi > 0) ypl1 = ypl2 + atick[ltick];
1476 else ypl1 = ypl2 - atick[ltick];
1479 xpl1 = 0.5*(xpl1 + xpl2);
1481 ypl1 = 0.5*(ypl1 + ypl2) + atick[ltick];
1482 ypl2 = 0.5*(ypl1 + ypl2) - atick[ltick];
1486 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1489 Rotate(xtick1,0,cosphi,sinphi,xx0,yy0 ,xpl2,ypl2);
1490 Rotate(xtick1,grid_side*gridlength,cosphi,sinphi,xx0,yy0,xpl1,ypl1);
1501 if (!drawGridOnly && !optionUnlab) {
1505 if ((wmin == wmax) || (ndiv == 0)) {
1506 Error(where,
"wmin (%f) == wmax (%f), or ndiv == 0", wmin, wmax);
1510 dwlabel = (wmax-wmin)/
Double_t(n1a);
1511 if (optionNoopt && !optionInt) dxlabel = axis_length/
Double_t(n1a);
1512 else dxlabel = axis_lengthN/
Double_t(n1a);
1514 if (!optionText && !optionTime) {
1536 if (iexe%3 == 1) iexe += 2;
1537 else if(iexe%3 == 2) iexe += 1;
1538 if (nexe < 0) nexe = -iexe;
1551 if (!noExponent && nf > maxDigits) flexpo =
kTRUE;
1552 if (!noExponent && nf < -maxDigits) flexne =
kTRUE;
1563 if (nexe%3 == 0 && ww <=
TMath::Power(10,maxDigits-1))
break;
1575 if (nexe%3 == 0 && ww >= rne)
break;
1580 for (i=maxDigits-1; i>0; i--) {
1586 if (wdyn <= 0.999 && na < maxDigits-2) {
1604 coded = &chcoded[0];
1605 if (if1 > 14) if1=14;
1606 if (if2 > 14) if2=14;
1607 if (if2>0) snprintf(coded,8,
"%%%d.%df",if1,if2);
1608 else snprintf(coded,8,
"%%%d.%df",if1+1,1);
1613 snprintf(chtemp,256,
"%g",dwlabel);
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 strftime(label, 256, timeformattmp.
Data(), utctis);
1716 strncpy(chtemp, &label[0], 256);
1717 first = 0; last=strlen(label)-1;
1718 wlabel = wTimeIni + (k+1)*dwlabel;
1723 if (optionNoopt && !optionInt)
1724 Rotate (xlabel,ylabel,cosphi,sinphi,x0,y0,xx,yy);
1725 else Rotate (xlabel,ylabel,cosphi,sinphi,xx0,yy0,xx,yy);
1726 if (y0 == y1 && !optionDown && !optionUp) {
1727 yy -= 0.80*charheight;
1730 if (x0 != x1 && y0 != y1) {
1731 if (optionNoopt && !optionInt)
1732 Rotate (xlabel,0,cosphi,sinphi,x0,y0,xx,yy);
1733 else Rotate (xlabel,0,cosphi,sinphi,xx0,yy0,xx,yy);
1734 if (cosphi > 0 ) yy += ylabel;
1735 if (cosphi < 0 ) yy -= ylabel;
1738 if (!optionY || (x0 == x1)) {
1740 if (first > last) strncpy(chtemp,
" ", 256);
1741 else strncpy(chtemp, &label[first], 256);
1743 if (!optionTime) typolabel.
ReplaceAll(
"-",
"#minus");
1761 if (!optionText) lnlen = last-first+1;
1763 if (k+1 > nhilab) lnlen = 0;
1765 for ( l=1; l<=lnlen; l++) {
1766 if (!optionText) *chtemp = label[first+l-2];
1768 if (lnlen == 0) strncpy(chtemp,
" ", 256);
1769 else strncpy(chtemp,
"1", 256);
1778 yy -= charheight*1.3;
1785 if (flexe && !optionText && nexe) {
1786 snprintf(label,256,
"#times10^{%d}", nexe);
1787 if (x0 != x1) { xfactor = x1-x0+0.1*charheight; yfactor = 0; }
1788 else { xfactor = y1-y0+0.1*charheight; yfactor = 0; }
1789 Rotate (xfactor,yfactor,cosphi,sinphi,x0,y0,xx,yy);
1815 if (optionLog && ndiv) {
1816 UInt_t xi1=0,xi2=0,wi=0,yi1=0,yi2=0,
hi=0,xl=0,xh=0;
1818 if ((wmin == wmax) || (ndiv == 0)) {
1819 Error(where,
"wmin (%f) == wmax (%f), or ndiv == 0", wmin, wmax);
1823 Error(where,
"negative logarithmic axis");
1827 Error(where,
"negative logarithmic axis");
1831 if (xmnlog > 0) xmnlog += 1.E-6;
1832 else xmnlog -= 1.E-6;
1837 if (h2 > 0) h2 += 1.E-6;
1842 axmul = (x11-x00)/(h2sav-xmnlog);
1847 if ( xmnlog > 0 && (xmnlog-
Double_t(ih1) > 0) ) labelnumber++;
1848 for (j=1; j<=nbinin; j++) {
1853 if (x0 == x1 && j == 1) ylabel += charheight*0.33;
1854 if (y0 == y1 && j == 1) ylabel -= charheight*0.65;
1855 xone = x00+axmul*(
Double_t(decade)-xmnlog);
1857 if (j < 0)
printf(
"j=%d\n",j);
1858 if (x00 > xone)
goto L160;
1859 if ((xone-x11)>epsilon)
break;
1862 if (!mside) y -= atick[0];
1863 Rotate(xone,y,cosphi,sinphi,x0,y0,xpl2,ypl2);
1864 Rotate(xtwo,atick[0],cosphi,sinphi,x0,y0,xpl1,ypl1);
1866 if ((x0 != x1) && (y0 != y1)) {
1869 if (cosphi > 0) ypl1 = ypl2 + atick[0];
1870 else ypl1 = ypl2 - atick[0];
1873 xpl1 = 0.5*(xpl1 + xpl2);
1875 ypl1 = 0.5*(ypl1 + ypl2) + atick[0];
1876 ypl2 = 0.5*(ypl1 + ypl2) - atick[0];
1880 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1883 Rotate(xone,0,cosphi,sinphi,x0,y0,xpl2,ypl2);
1884 Rotate(xone,grid_side*gridlength,cosphi,sinphi,x0,y0,xpl1,ypl1);
1888 if (!drawGridOnly && !optionUnlab) {
1893 snprintf(label,256,
"%f", rlab);
1895 while (last > first) {
1896 if (label[last] !=
'0')
break;
1900 if (label[last] ==
'.') {label[last] = 0; last--;}
1902 snprintf(label,256,
"%d", labelnumber);
1905 Rotate (xone,ylabel,cosphi,sinphi,x0,y0,xx,yy);
1906 if ((x0 == x1) && !optionPara) {
1909 if (labelnumber == 0) nch=1;
1911 xx += nch*charheight;
1913 xx += 0.25*charheight;
1916 xx += 0.25*charheight;
1918 if ((y0 == y1) && !optionDown && !optionUp) {
1919 if (noExponent) yy += 0.33*charheight;
1921 if (n1a == 0)
goto L210;
1923 if (kmod == 0) kmod=1000000;
1924 if ((nbinin <= n1a) || (j == 1) || (j == nbinin) || ((nbinin > n1a)
1925 && (j%kmod == 0))) {
1926 if (labelnumber == 0) {
1928 }
else if (labelnumber == 1) {
1934 snprintf(chtemp,256,
"10^{%d}", labelnumber);
1947 for (k=2;k<10;k++) {
1951 if (x00 > xone)
continue;
1952 if (xone > x11)
goto L200;
1954 if (!mside) y -= atick[1];
1956 Rotate(xone,y,cosphi,sinphi,x0,y0,xpl2,ypl2);
1957 Rotate(xtwo,atick[1],cosphi,sinphi,x0,y0,xpl1,ypl1);
1959 if ((x0 != x1) && (y0 != y1)) {
1962 if (cosphi > 0) ypl1 = ypl2 + atick[1];
1963 else ypl1 = ypl2 - atick[1];
1966 xpl1 = 0.5*(xpl1+xpl2);
1968 ypl1 = 0.5*(ypl1+ypl2) + atick[1];
1969 ypl2 = 0.5*(ypl1+ypl2) - atick[1];
1974 if ((nbinin <= idn) || ((nbinin > idn) && (k == 5))) {
1975 if (!drawGridOnly)
PaintLineNDC(xpl1, ypl1, xpl2, ypl2);
1979 if (moreLogLabels && !optionUnlab && !drawGridOnly && !overlap) {
1982 snprintf(chtemp,256,
"%g", rlab);
1984 if (labelnumber-1 == 0) {
1985 snprintf(chtemp,256,
"%d", k);
1986 }
else if (labelnumber-1 == 1) {
1987 snprintf(chtemp,256,
"%d", 10*k);
1989 snprintf(chtemp,256,
"%d#times10^{%d}", k, labelnumber-1);
1992 Rotate (xone,ylabel,cosphi,sinphi,x0,y0,xx,yy);
1993 if ((x0 == x1) && !optionPara) {
1996 if (labelnumber == 0) nch=1;
1998 xx += nch*charheight;
2000 if (labelnumber >= 0) xx += 0.25*charheight;
2001 else xx += 0.50*charheight;
2004 xx += 0.25*charheight;
2006 if ((y0 == y1) && !optionDown && !optionUp) {
2007 if (noExponent) yy += 0.33*charheight;
2010 if ((x0 != x1) && (y0 != y1)) {
2011 Rotate(xone,ylabel,cosphi,sinphi,x0,y0,xx,yy);
2012 if (cosphi > 0) yy += ylabel;
2021 xi1 =
gPad->XtoAbsPixel(u);
2022 yi1 =
gPad->YtoAbsPixel(v);
2028 xi2 =
gPad->XtoAbsPixel(u);
2029 yi2 =
gPad->YtoAbsPixel(v);
2032 if ((x0 == x1 && yi1-
hi <= yi2) || (y0 == y1 && xl+wi >= xh)){
2046 if (optionGrid && nbinin <= 5 && ndiv > 100) {
2047 Rotate(xone,0,cosphi,sinphi,x0,y0,xpl2, ypl2);
2048 Rotate(xone,grid_side*gridlength,cosphi,sinphi,x0,y0, xpl1,ypl1);
2060 if (optionGrid)
delete linegrid;
2079 if (binWidth <= 1) { binWidth = 1; binLow = int(A1); }
2081 Int_t width = int(binWidth/5) + 1;
2083 binLow = int(A1/binWidth)*binWidth;
2089 for (
Int_t ic=0; ic<1000; ic++) {
2091 Int_t ibl = int(binLow/binWidth);
2092 if ( (rbl-ibl) == 0 || ic > width) { binLow -= 5;
break;}
2099 while (xb <= binHigh) {
2103 binHigh = xb - binWidth;
2111 last = strlen(label)-1;
2112 for (
Int_t i=0; i<=last; i++) {
2113 if (strchr(
"1234567890-+.", label[i]) ) { first = i;
return; }
2115 Error(
"LabelsLimits",
"attempt to draw a blank label");
2139 out<<
"gaxis = new TGaxis("<<
fX1<<
","<<
fY1<<
","<<
fX2<<
","<<
fY2
2140 <<
","<<fWmin<<
","<<fWmax<<
","<<fNdiv<<
","<<quote<<
fChopt.
Data()<<quote<<
");"<<std::endl;
2141 out<<
" gaxis->SetLabelOffset("<<
GetLabelOffset()<<
");"<<std::endl;
2142 out<<
" gaxis->SetLabelSize("<<
GetLabelSize()<<
");"<<std::endl;
2143 out<<
" gaxis->SetTickSize("<<
GetTickSize()<<
");"<<std::endl;
2144 out<<
" gaxis->SetGridLength("<<
GetGridLength()<<
");"<<std::endl;
2145 out<<
" gaxis->SetTitleOffset("<<
GetTitleOffset()<<
");"<<std::endl;
2146 out<<
" gaxis->SetTitleSize("<<
GetTitleSize()<<
");"<<std::endl;
2147 out<<
" gaxis->SetTitleColor("<<
GetTextColor()<<
");"<<std::endl;
2148 out<<
" gaxis->SetTitleFont("<<
GetTextFont()<<
");"<<std::endl;
2151 out<<
" gaxis->SetName("<<quote<<
GetName()<<quote<<
");"<<std::endl;
2154 out<<
" gaxis->SetTitle("<<quote<<
GetTitle()<<quote<<
");"<<std::endl;
2160 out<<
" gaxis->SetLabelColor(ci);" << std::endl;
2162 out<<
" gaxis->SetLabelColor("<<
GetLabelColor()<<
");"<<std::endl;
2167 out<<
" gaxis->SetLineColor(ci);" << std::endl;
2169 out<<
" gaxis->SetLineColor("<<
GetLineColor()<<
");"<<std::endl;
2172 out<<
" gaxis->SetLineStyle("<<
GetLineStyle()<<
");"<<std::endl;
2175 out<<
" gaxis->SetLineWidth("<<
GetLineWidth()<<
");"<<std::endl;
2177 if (fLabelFont != 62) {
2178 out<<
" gaxis->SetLabelFont("<<
GetLabelFont()<<
");"<<std::endl;
2181 out<<
" gaxis->SetMoreLogLabels();"<<std::endl;
2184 out<<
" gaxis->SetNoExponent();"<<std::endl;
2187 out<<
" gaxis->Draw();"<<std::endl;
2215 Error(
"SetFunction",
"unknown function: %s", funcname);
2339 timeoff = (time_t)((
Long_t)(toffset));
2343 utctis = gmtime(&timeoff);
2345 strftime(tmp, 20,
"%Y-%m-%d %H:%M:%S",utctis);
2350 snprintf(tmp,20,
"s%g",ds);
2381 void TGaxis::Streamer(
TBuffer &R__b)
2391 TLine::Streamer(R__b);
2392 TAttText::Streamer(R__b);
2407 fName.Streamer(R__b);
Int_t GetFirst() const
Return first bin on the axis i.e.
virtual Style_t GetLineStyle() const
virtual void SetLineWidth(Width_t lwidth)
Width_t GetGridWidth() const
virtual Color_t GetAxisColor() 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.
Float_t GetLabelOffset() const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual Color_t GetLabelColor() const
virtual Float_t GetTextAngle() const
Float_t GetTickSize() const
virtual Font_t GetTextFont() const
Int_t GetLabelFont() const
Double_t GetTimeOffset() const
const char * GetBinLabel(Int_t bin) const
Return label for bin.
static Int_t fgMaxDigits
pointer to original TAxis axis (if any)
Color_t GetGridColor() const
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.
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 GetTitleOffset() const
virtual const char * GetName() const
Returns name of object.
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.
Buffer base class used for serializing objects.
virtual Float_t GetTextSize() const
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
TGaxis & operator=(const TGaxis &)
Assignment operator.
virtual void SetTitle(const char *title="")
Change the title of the axis.
Int_t GetLabelColor() const
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.
virtual Color_t GetTitleColor() const
virtual void PaintTextNDC(Double_t u, Double_t v, const char *text)
Draw this text with new coordinates in NDC.
virtual Style_t GetTitleFont() const
Float_t GetTitleSize() const
TAxis * fAxis
Pointer to function computing axis values.
virtual Float_t GetTitleSize() const
virtual Double_t GetXmin() 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.
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.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
const char * Data() const
void SetTitleSize(Float_t titlesize)
virtual void SetTextFont(Font_t tfont=62)
static Float_t fXAxisExpYOffset
Exponent X offset for the X axis.
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.
Double_t dot(const TVector2 &v1, const TVector2 &v2)
static Float_t fYAxisExpYOffset
Exponent X offset for the Y axis.
virtual void SetText(Double_t x, Double_t y, const char *text)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
To draw Mathematical Formula.
virtual Color_t GetTextColor() const
Double_t Log10(Double_t x)
void SetOption(Option_t *option="")
To set axis options.
Float_t GetGridLength() const
virtual const char * Getenv(const char *env)
Get environment variable.
TString & Append(const char *cs)
void SetTimeFormat(const char *tformat)
Change the format used for time plotting.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Double_t ATan2(Double_t, Double_t)
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
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 Double_t GetXmax() const
virtual Float_t GetTitleOffset() const
void SetLabelSize(Float_t labelsize)
virtual void SetTextAlign(Short_t align=11)
virtual const char * GetTimeFormat() const
virtual void SetLineColor(Color_t lcolor)
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.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
Double_t GetXsize()
Return size of the formula along X in pad coordinates.
Class to manage histogram axis.
R__EXTERN TSystem * gSystem
static void SetMaxDigits(Int_t maxd=5)
Static function to set fgMaxDigits for axis.
Int_t GetStripDecimals() const
void SetFunction(const char *funcname="")
Specify a function to map the axis values.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetTextAngle(Float_t tangle=0)
Bool_t TestBit(UInt_t f) const
void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE)
Return text size in pixels.
virtual const char * GetName() const
Returns name of object.
const char * GetTitle() const
Returns title of object.
Bool_t GetDecimals() const
virtual Color_t GetLineColor() const
virtual void Unsetenv(const char *name)
Unset environment variable.
static Float_t fYAxisExpXOffset
Exponent Y offset for the X axis.
TString & Remove(Ssiz_t pos)
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
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.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual Style_t GetLabelFont() const
static RooMathCoreReg dummy
void SetLabelFont(Int_t labelfont)
virtual void SetLineStyle(Style_t lstyle)
static Int_t GetMaxDigits()
Static function returning fgMaxDigits (See SetMaxDigits).
Int_t GetLast() const
Return last bin on the axis i.e.
Binding & operator=(OUT(*fun)(void))
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual Float_t GetLabelSize() const
THashList * GetLabels() const
virtual void Paint(Option_t *chopt="")
Draw this axis with its current attributes.
Style_t GetGridStyle() 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.
Float_t GetLabelSize() const
Short_t Max(Short_t a, Short_t b)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void SetTimeOffset(Double_t toffset, Option_t *option="local")
Change the time offset. If option = "gmt", set display mode to GMT.
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
void SetTickSize(Float_t ticksize)
void SetLabelColor(Int_t labelcolor)
virtual void SetTextColor(Color_t tcolor=1)
float type_of_call hi(const int &, const int &)
virtual const char * GetTitle() const
Returns title of object.
Double_t Sqrt(Double_t x)
virtual void SetTextSize(Float_t tsize=1)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void SetTitleOffset(Float_t titleoffset=1)
virtual Width_t GetLineWidth() const
virtual Float_t GetTickLength() const
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
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.
static Float_t fXAxisExpXOffset
Number of digits above which the 10>N notation is used.
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.
virtual Float_t GetLabelOffset() const