Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
rline_style.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_rcanvas
3///
4/// This ROOT 7 example shows the various line styles.
5///
6/// \macro_image (rcanvas_js)
7/// \macro_code
8///
9/// \date 2018-03-18
10/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
11/// is welcome!
12/// \author Iliana Betsou
13
14#include "ROOT/RCanvas.hxx"
15#include "ROOT/RText.hxx"
16#include "ROOT/RLine.hxx"
17
18void rline_style()
19{
20 using namespace ROOT::Experimental;
21
22 auto canvas = RCanvas::Create("Different RLine styles");
23 auto posy = 0.9_normal;
24
25 for (int i = 1; i <= 11; i++) {
26 std::string lbl;
27 if (i < 11)
28 lbl = std::to_string(i);
29 else
30 lbl = "Custom";
31
32 auto text = canvas->Add<RText>(RPadPos{.3_normal, posy}, lbl);
33 text->text.size = 0.04;
34 text->text.align = RAttrText::kRightCenter;
35 text->text.font = RAttrFont::kArialOblique;
36
37 auto draw = canvas->Add<RLine>(RPadPos{.32_normal, posy}, RPadPos{.8_normal, posy});
38 if (i < 11)
39 draw->line.style = (RAttrLine::EStyle) i;
40 else
41 draw->line.pattern = "10,2,8,2,10,6,1,6";
42
43 posy -= 0.05_normal;
44 }
45
46 canvas->Show();
47}
A position (horizontal and vertical) in a RPad.
Definition RPadPos.hxx:28
TText * text