Wrapper class for ROOT TLegend.
More...
#include <JLegend.hh>
|
| JLegend (const Int_t width, const Int_t height, const std::string option="TR") |
| Constructor. More...
|
|
Wrapper class for ROOT TLegend.
Definition at line 23 of file JLegend.hh.
JGIZMO::JLegend::JLegend |
( |
const Int_t |
width, |
|
|
const Int_t |
height, |
|
|
const std::string |
option = "TR" |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
width | width [characters] |
height | height [lines] |
option | position [TR TL BL BR] |
Definition at line 34 of file JLegend.hh.
47 SetTextFont(gStyle->GetStatFont());
48 SetTextSize(gStyle->GetStatFontSize());
50 const Double_t X1 = 0.0 + gPad->GetLeftMargin();
51 const Double_t X2 = 1.0 - gPad->GetRightMargin();
52 const Double_t Y1 = 0.0 + gPad->GetBottomMargin();
53 const Double_t Y2 = 1.0 - gPad->GetTopMargin();
55 const Double_t w = gPad->XtoPixel(gPad->GetX2());
56 const Double_t h = gPad->YtoPixel(gPad->GetY1());
57 const Double_t ch = gStyle->GetStatFontSize() * (w < h ? w : h);
59 const Double_t fx = 0.70 * ch/w;
60 const Double_t fy = 1.10 * ch/h;
61 const Double_t eps = 0.002;
70 SetMargin((Double_t) nc / (Double_t) (wd + nc));
72 Double_t W = (wd + nc) * fx;
73 Double_t
H = (height) * fy;
77 if (fc * W > X2 - X1 - 2*eps) {
78 fc *= (X2 - X1 - 2*eps) / W;
81 if (fc *
H > Y2 - Y1 - 2*eps) {
82 fc *= (Y2 - Y1 - 2*eps) /
H;
85 SetTextSize(GetTextSize() * fc);
92 Double_t x1 = X2 - W - eps;
93 Double_t y1 = Y2 -
H - eps;
94 Double_t x2 = X2 - eps;
95 Double_t y2 = Y2 - eps;
100 if (option.find(
'T') != string::npos && option.find(
'B') == string::npos) {
108 if (option.find(
'B') != string::npos && option.find(
'T') == string::npos) {
116 if (option.find(
'R') != string::npos && option.find(
'L') == string::npos) {
124 if (option.find(
'L') != string::npos && option.find(
'R') == string::npos) {
132 SetTextAlign(halign*10 + valign);
The documentation for this class was generated from the following file: