16#include "ROOT/RText.hxx"
17#include "ROOT/RLine.hxx"
25 auto canvas = RCanvas::Create(
"Use RStyle for line styling");
28 for (
int i = 10; i > 0; i--){
31 auto text = canvas->Add<RText>(
RPadPos{.3_normal, 1_normal*num}, std::to_string(i));
32 text->text.size = 0.04;
33 text->text.align = RAttrText::kRightCenter;
34 text->text.font = RAttrFont::kArialOblique;
36 auto line = canvas->Add<RLine>(
RPadPos(.32_normal,1_normal*num),
RPadPos(.8_normal, 1_normal*num));
37 line->SetId(std::string(
"obj") + std::to_string(i));
38 line->SetCssClass(std::string(
"user_class_") + std::to_string(i % 3));
41 auto style = std::make_shared<RStyle>();
43 style->AddBlock(
".user_class_1").AddInt(
"line_style", 4);
44 style->AddBlock(
".user_class_2").AddDouble(
"line_width", 5.);
45 style->AddBlock(
"#obj7").AddString(
"line_color",
"#0000FF");
47 style->AddBlock(
"line").AddString(
"line_color",
"red");
49 canvas->UseStyle(
style);
54 RDirectory::Heap().Add(
"rstyle",
style);
A position (horizontal and vertical) in a RPad.