Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
draw_pave.cxx
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_v7
3///
4/// This macro generates a small V7 TH1D, fills it and draw it in a V7 canvas.
5/// The canvas is display in the web browser
6///
7/// \macro_code
8///
9/// \date 2015-03-22
10/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
11/// \author Axel Naumann <axel@cern.ch>
12
13/*************************************************************************
14 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
15 * All rights reserved. *
16 * *
17 * For the licensing terms see $ROOTSYS/LICENSE. *
18 * For the list of contributors see $ROOTSYS/README/CREDITS. *
19 *************************************************************************/
20
21#include "ROOT/RCanvas.hxx"
22#include "ROOT/RPave.hxx"
23#include "ROOT/RPaveText.hxx"
24
25// macro must be here while cling is not capable to load
26// library automatically for outlined function see ROOT-10336
27R__LOAD_LIBRARY(ROOTGpadv7)
28
29using namespace ROOT::Experimental;
30
31void draw_pave()
32{
33 // Create a canvas to be displayed.
34 auto canvas = RCanvas::Create("Canvas Title");
35
36 // RFrame will be automatically created as well
37 auto pave = canvas->Draw<RPave>();
38 pave->AttrFill().SetColor(RColor::kBlue);
39 pave->AttrBorder().SetColor(RColor::kGreen).SetWidth(3);
40 pave->SetCornerY(-0.03_normal);
41 pave->SetHeight(0.2_normal);
42
43 auto text = canvas->Draw<RPaveText>();
44 text->AddLine("This is RTextPave");
45 text->AddLine("It can have several lines");
46 text->AddLine("It should be positioned below RPave");
47 text->AttrFill().SetColor(RColor::kYellow);
48 text->SetCornerY(0.25_normal);
49 text->SetHeight(0.3_normal);
50
51 canvas->SetSize(1000, 700);
52 canvas->Show();
53}
#define R__LOAD_LIBRARY(LIBRARY)
Definition Rtypes.h:472
RAttrFill & SetColor(const RColor &color)
The fill color.
Definition RAttrFill.hxx:39
Base class for paves with text, statistic, legends, placed relative to RFrame position and adjustable...
Definition RPave.hxx:31
RAttrFill & AttrFill()
Definition RPave.hxx:67
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition TObject.cxx:197
TText * text