24#include "ROOT/RFrameTitle.hxx"
27#include "ROOT/RLine.hxx"
28#include "ROOT/RText.hxx"
29#include "ROOT/RBox.hxx"
33auto rframe_style = RStyle::Parse(
"frame { x_ticks_width: 3; y_ticks_width: 3; }"
34 "title { margin: 0.02; height: 0.1; text_color: blue; text_size: 0.07; }"
35 "line { line_width: 2; }"
36 "text { text_align: 13; text_size: 0.03; }");
41 auto canvas = RCanvas::Create(
"RFrame with drawAxes enabled");
44 auto frame = canvas->AddFrame();
47 frame->border.color = RColor::kBlue;
48 frame->border.width = 3;
49 frame->margins = 0.2_normal;
50 frame->margins.top = 0.25_normal;
53 frame->drawAxes =
true;
58 frame->x.zoomMin = 5.;
59 frame->x.zoomMax = 95.;
60 frame->x.line.color = RColor::kGreen;
65 frame->y.zoomMax = 95;
66 frame->y.line.color = RColor::kBlue;
68 auto title = canvas->Draw<RFrameTitle>(
"Frame title");
69 title->margin = 0.01_normal;
70 title->height = 0.1_normal;
73 auto line0 = canvas->Draw<RLine>(
RPadPos(100_px, .9_normal),
RPadPos(900_px , .9_normal));
74 auto text0 = canvas->Draw<RText>(
RPadPos(100_px, .9_normal + 5_px),
"Line drawn on pad, fix pixel length");
75 text0->text.align = RAttrText::kLeftBottom;
78 auto line1 = canvas->Draw<RLine>(
RPadPos(.1_normal, .1_normal),
RPadPos(.9_normal, .1_normal));
79 auto text1 = canvas->Draw<RText>(
RPadPos(.1_normal, .1_normal),
"Line drawn on pad, normalized coordinates");
82 auto line2 = canvas->Draw<RLine>(
RPadPos(-.2_normal, -.1_normal),
RPadPos(-.2_normal , 1.1_normal));
83 line2->onFrame =
true;
84 line2->line.color = RColor::kRed;
86 auto text2 = canvas->Draw<RText>(
RPadPos(-.2_normal - 5_px, -.1_normal),
"Line drawn on frame, normalized coordinates");
87 text2->onFrame =
true;
88 text2->text.angle = 90;
89 text2->text.align = RAttrText::kLeftBottom;
92 auto line3 = canvas->Draw<RLine>(
RPadPos(110_user, -.1_normal),
RPadPos(110_user, 1.1_normal));
93 line3->onFrame =
true;
94 line3->line.color = RColor::kRed;
96 auto text3 = canvas->Draw<RText>(
RPadPos(110_user, -.1_normal),
"Line drawn on frame, user coordinates");
97 text3->onFrame =
true;
98 text3->text.angle = 90;
101 auto box4 = canvas->Draw<RBox>(
RPadPos(80_user - 20_px, 80_user - 20_px),
RPadPos(80_user + 20_px, 80_user + 20_px));
102 box4->fill.color = RColor::kBlue;
103 box4->fill.style = RAttrFill::kSolid;
104 box4->clipping =
true;
105 box4->onFrame =
true;
108 auto line4 = canvas->Draw<RLine>(
RPadPos(20_user, 20_user),
RPadPos(80_user, 80_user));
109 line4->clipping =
true;
110 line4->onFrame =
true;
112 auto text4 = canvas->Draw<RText>(
RPadPos(20_user, 20_user),
"clipping on");
113 text4->onFrame =
true;
114 text4->clipping =
true;
117 auto box5 = canvas->Draw<RBox>(
RPadPos(80_user - 20_px, 20_user - 20_px),
RPadPos(80_user + 20_px, 20_user + 20_px));
118 box5->fill.color = RColor::kYellow;
119 box5->fill.style = RAttrFill::kSolid;
120 box5->onFrame =
true;
123 auto line5 = canvas->Draw<RLine>(
RPadPos(20_user, 80_user),
RPadPos(80_user, 20_user));
124 line5->onFrame =
true;
126 auto text5 = canvas->Draw<RText>(
RPadPos(20_user, 80_user),
"clipping off");
127 text5->onFrame =
true;
128 text5->text.align = RAttrText::kLeftBottom;
130 canvas->UseStyle(rframe_style);
A position (horizontal and vertical) in a RPad.