Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RAttrAxis.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_RAttrAxis
10#define ROOT7_RAttrAxis
11
12#include <ROOT/RAttrBase.hxx>
13#include <ROOT/RAttrLine.hxx>
14#include <ROOT/RAttrText.hxx>
15#include <ROOT/RAttrValue.hxx>
16#include <ROOT/RPadLength.hxx>
17
18namespace ROOT {
19namespace Experimental {
20
21/** \class RAttrAxis
22\ingroup GpadROOT7
23\author Sergey Linev <s.linev@gsi.de>
24\date 2020-02-20
25\brief All supported axes attributes for: line, ticks, labels, title, min/max, log, reverse, ...
26\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
27*/
28
29class RAttrAxis : public RAttrBase {
30
31 RAttrValue<double> fZoomMin{this, "zoommin", 0.}; ///<! axis zoom min
32 RAttrValue<double> fZoomMax{this, "zoommax", 0.}; ///<! axis zoom max
33 RAttrValue<double> fLog{this, "log", 0}; ///<! log scale, <1 off, 1 - base10, 2 - base 2, 2.71 - exp, 3, 4, ...
34 RAttrValue<bool> fReverse{this, "reverse", false}; ///<! reverse scale
35 RAttrValue<bool> fTimeDisplay{this, "time", false}; ///<! time display
36 RAttrValue<double> fTimeOffset{this, "time_offset", 0}; ///<! time offset to display
37 RAttrValue<std::string> fTimeFormat{this, "time_format", ""}; ///<! time format
38 RAttrLine fAttrLine{this, "line"}; ///<! line attributes
39 RAttrValue<std::string> fEndingStyle{this, "ending_style", ""}; ///<! axis ending style - none, arrow, circle
40 RAttrValue<RPadLength> fEndingSize{this, "ending_size", 0.02_normal}; ///<! axis ending size
41 RAttrValue<std::string> fTicksSide{this, "ticks_side", "normal"}; ///<! ticks position - normal, invert, both
42 RAttrValue<RPadLength> fTicksSize{this, "ticks_size", 0.02_normal}; ///<! ticks size
43 RAttrColor fTicksColor{this, "ticks_color"}; ///<! ticks color
44 RAttrText fLabelsAttr{this, "labels"}; ///<! text attributes for labels
45 RAttrValue<RPadLength> fLabelsOffset{this, "labels_offset", {}}; ///<! axis labels offset - relative
46 RAttrValue<bool> fLabelsCenter{this, "labels_center", false}; ///<! center labels
47 RAttrText fTitleAttr{this, "title"}; ///<! axis title text attributes
48 RAttrValue<std::string> fTitle{this, "title", ""}; ///<! axis title
49 RAttrValue<std::string> fTitlePos{this, "title_position", "right"}; ///<! axis title position - left, right, center
50 RAttrValue<RPadLength> fTitleOffset{this, "title_offset", {}}; ///<! axis title offset - relative
51
53
54 RAttrAxis &SetZoomMin(double min) { fZoomMin = min; return *this; }
55 RAttrAxis &SetZoomMax(double max) { fZoomMax = max; return *this; }
56 double GetZoomMin() const { return fZoomMin; }
57 double GetZoomMax() const { return fZoomMax; }
58 bool HasZoomMin() const { return fZoomMin.Has(); }
59 bool HasZoomMax() const { return fZoomMax.Has(); }
60
61 RAttrAxis &SetZoom(double min, double max) { SetZoomMin(min); SetZoomMax(max); return *this; }
63
64 RAttrAxis &SetLog(double base = 10) { fLog = (base < 1) ? 0 : base; return *this; }
65 double GetLog() const { return fLog; }
66
67 RAttrAxis &SetReverse(bool on = true) { fReverse = on; return *this; }
68 bool GetReverse() const { return fReverse; }
69
70 RAttrAxis &SetTimeDisplay(const std::string &fmt = "", double offset = -1)
71 {
72 fTimeDisplay = true;
73 if (!fmt.empty()) fTimeFormat = fmt;
74 if (offset >= 0) fTimeOffset = offset;
75 return *this;
76 }
77 bool GetTimeDisplay() const { return fTimeDisplay; }
79 {
83 }
84
85 const RAttrLine &GetAttrLine() const { return fAttrLine; }
86 RAttrAxis &SetAttrLine(const RAttrLine &line) { fAttrLine = line; return *this; }
88
89 RAttrAxis &SetEndingSize(const RPadLength &sz) { fEndingSize = sz; return *this; }
91
92 RAttrAxis &SetEndingStyle(const std::string &st) { fEndingStyle = st; return *this; }
93 RAttrAxis &SetEndingArrow() { return SetEndingStyle("arrow"); }
94 RAttrAxis &SetEndingCircle() { return SetEndingStyle("cicrle"); }
95 std::string GetEndingStyle() const { return fEndingStyle; }
96
97 RAttrAxis &SetTicksSize(const RPadLength &sz) { fTicksSize = sz; return *this; }
99
100 RAttrAxis &SetTicksSide(const std::string &side) { fTicksSide = side; return *this; }
101 RAttrAxis &SetTicksNormal() { return SetTicksSide("normal"); }
102 RAttrAxis &SetTicksInvert() { return SetTicksSide("invert"); }
103 RAttrAxis &SetTicksBoth() { return SetTicksSide("both"); }
104 std::string GetTicksSide() const { return fTicksSide; }
105
106 RAttrAxis &SetTicksColor(const RColor &color) { fTicksColor = color; return *this; }
109
110 RAttrAxis &SetLabelsOffset(const RPadLength &len) { fLabelsOffset = len; return *this; }
112
113 const RAttrText &GetLabelsAttr() const { return fLabelsAttr; }
114 RAttrAxis &SetLabelsAttr(const RAttrText &attr) { fLabelsAttr = attr; return *this; }
116
117 RAttrAxis &SetLabelsCenter(bool on = true) { fLabelsCenter = on; return *this; }
118 bool GetLabelsCenter() const { return fLabelsCenter; }
119
120 const RAttrText &GetTitleAttr() const { return fTitleAttr; }
121 RAttrAxis &SetTitleAttr(const RAttrText &attr) { fTitleAttr = attr; return *this; }
123
124 RAttrAxis &SetTitle(const std::string &title) { fTitle = title; return *this; }
125 std::string GetTitle() const { return fTitle; }
126
127 RAttrAxis &SetTitlePos(const std::string &pos) { fTitlePos = pos; return *this; }
128 RAttrAxis &SetTitleLeft() { return SetTitlePos("left"); }
129 RAttrAxis &SetTitleCenter() { return SetTitlePos("center"); }
130 RAttrAxis &SetTitleRight() { return SetTitlePos("right"); }
131 std::string GetTitlePos() const { return fTitlePos; }
132
133 RAttrAxis &SetTitleOffset(const RPadLength &len) { fTitleOffset = len; return *this; }
135};
136
137} // namespace Experimental
138} // namespace ROOT
139
140#endif
All supported axes attributes for: line, ticks, labels, title, min/max, log, reverse,...
Definition RAttrAxis.hxx:29
RAttrValue< std::string > fTitlePos
! axis title position - left, right, center
Definition RAttrAxis.hxx:49
RAttrValue< double > fZoomMin
! axis zoom min
Definition RAttrAxis.hxx:31
RAttrAxis & SetZoom(double min, double max)
Definition RAttrAxis.hxx:61
RAttrValue< std::string > fTimeFormat
! time format
Definition RAttrAxis.hxx:37
RAttrValue< RPadLength > fEndingSize
! axis ending size
Definition RAttrAxis.hxx:40
RAttrValue< RPadLength > fLabelsOffset
! axis labels offset - relative
Definition RAttrAxis.hxx:45
RAttrColor fTicksColor
! ticks color
Definition RAttrAxis.hxx:43
RPadLength GetTicksSize() const
Definition RAttrAxis.hxx:98
RAttrValue< std::string > fEndingStyle
! axis ending style - none, arrow, circle
Definition RAttrAxis.hxx:39
RAttrText fLabelsAttr
! text attributes for labels
Definition RAttrAxis.hxx:44
RAttrAxis & SetLog(double base=10)
Definition RAttrAxis.hxx:64
RAttrAxis & SetEndingStyle(const std::string &st)
Definition RAttrAxis.hxx:92
RAttrAxis & SetTitleAttr(const RAttrText &attr)
RAttrAxis & SetEndingSize(const RPadLength &sz)
Definition RAttrAxis.hxx:89
RAttrAxis & SetTicksSize(const RPadLength &sz)
Definition RAttrAxis.hxx:97
RAttrAxis & SetTitle(const std::string &title)
RPadLength GetEndingSize() const
Definition RAttrAxis.hxx:90
RAttrValue< double > fLog
! log scale, <1 off, 1 - base10, 2 - base 2, 2.71 - exp, 3, 4, ...
Definition RAttrAxis.hxx:33
const RAttrText & GetTitleAttr() const
RAttrAxis & SetTimeDisplay(const std::string &fmt="", double offset=-1)
Definition RAttrAxis.hxx:70
RAttrValue< double > fZoomMax
! axis zoom max
Definition RAttrAxis.hxx:32
RAttrValue< RPadLength > fTitleOffset
! axis title offset - relative
Definition RAttrAxis.hxx:50
RAttrValue< std::string > fTitle
! axis title
Definition RAttrAxis.hxx:48
RAttrAxis & SetLabelsAttr(const RAttrText &attr)
RAttrAxis & SetTitlePos(const std::string &pos)
std::string GetTitlePos() const
std::string GetTitle() const
RAttrAxis & SetTitleOffset(const RPadLength &len)
RPadLength GetTitleOffset() const
RAttrAxis & SetZoomMax(double max)
Definition RAttrAxis.hxx:55
RAttrText fTitleAttr
! axis title text attributes
Definition RAttrAxis.hxx:47
RAttrValue< bool > fTimeDisplay
! time display
Definition RAttrAxis.hxx:35
std::string GetEndingStyle() const
Definition RAttrAxis.hxx:95
RAttrAxis & SetTicksColor(const RColor &color)
RAttrValue< bool > fLabelsCenter
! center labels
Definition RAttrAxis.hxx:46
R__ATTR_CLASS(RAttrAxis, "axis")
RAttrAxis & SetZoomMin(double min)
Definition RAttrAxis.hxx:54
const RAttrLine & GetAttrLine() const
Definition RAttrAxis.hxx:85
RAttrAxis & SetLabelsOffset(const RPadLength &len)
RAttrValue< RPadLength > fTicksSize
! ticks size
Definition RAttrAxis.hxx:42
const RAttrText & GetLabelsAttr() const
RAttrValue< bool > fReverse
! reverse scale
Definition RAttrAxis.hxx:34
RAttrAxis & SetReverse(bool on=true)
Definition RAttrAxis.hxx:67
RPadLength GetLabelsOffset() const
RAttrAxis & SetAttrLine(const RAttrLine &line)
Definition RAttrAxis.hxx:86
RAttrAxis & SetTicksSide(const std::string &side)
RAttrLine fAttrLine
! line attributes
Definition RAttrAxis.hxx:38
RAttrValue< double > fTimeOffset
! time offset to display
Definition RAttrAxis.hxx:36
std::string GetTicksSide() const
RAttrValue< std::string > fTicksSide
! ticks position - normal, invert, both
Definition RAttrAxis.hxx:41
RAttrAxis & SetLabelsCenter(bool on=true)
Base class for all attributes, used with RDrawable.
Definition RAttrBase.hxx:31
void Clear()
Clear all respective values from drawable. Only defaults can be used.
Access RColor from drawable attributes.
RColor GetColor() const
Extract RColor for given attribute.
Drawing line attributes for different objects.
Definition RAttrLine.hxx:27
Template class to access single value from drawable or other attributes.
The color class.
Definition RColor.hxx:35
TLine * line
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...