18#include <initializer_list>
80 if (opt.find(
'l') != std::string::npos)
SetLine(
true);
81 if (opt.find(
'f') != std::string::npos)
SetFill(
true);
82 if (opt.find(
'm') != std::string::npos)
SetMarker(
true);
83 if (opt.find(
'e') != std::string::npos)
SetError(
true);
90 REntry(
const std::string &lbl,
const std::string &opt)
98 REntry(std::shared_ptr<RDrawable> drawable,
const std::string &lbl,
const std::string &opt)
132 vect.emplace_back(&entry.fDrawable);
134 entry.fDrawable->CollectShared(vect);
142 if (!entry.IsCustomDrawable()) {
144 entry.fDrawable.reset_io();
148 return std::make_unique<RDrawableDisplayItem>(*
this);
155 if (!centry.IsCustomDrawable()) {
156 auto entry =
const_cast<REntry *
>(¢ry);
158 entry->fDrawableId.clear();
179 std::shared_ptr<RCustomDrawable>
AddEntry(
const std::string &lbl,
const std::string &opt =
"")
182 auto drawable = std::make_shared<RCustomDrawable>();
183 fEntries.back().fDrawable = drawable;
187 void AddEntry(
const std::shared_ptr<RDrawable> &drawable,
const std::string &lbl,
const std::string &opt =
"")
189 fEntries.emplace_back(drawable, lbl, opt);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Drawing fill attributes for different objects.
Drawing line attributes for different objects.
Base class for painting data for JS.
static std::string ObjectIDFromPtr(const void *ptr)
Construct fillid using pointer value.
RDrawable(const RDrawable &)=delete
Special drawable to let provide line, fill or marker attributes for legend.
RAttrMarker marker
! marker attributes
RAttrLine line
! line attributes
RAttrFill fill
! fill attributes
An entry in RLegend, references RDrawable and its attributes.
REntry & SetFill(bool on=true)
std::shared_ptr< RDrawable > GetDrawable() const
REntry & SetLine(bool on=true)
bool IsCustomDrawable() const
REntry(std::shared_ptr< RDrawable > drawable, const std::string &lbl, const std::string &opt)
Create entry with reference to existing drawable object.
REntry & SetMarker(bool on=true)
Internal::RIOShared< RDrawable > fDrawable
reference to RDrawable
void DecodeOptions(const std::string &opt)
const std::string & GetLabel() const
REntry(const std::string &lbl, const std::string &opt)
Create entry without reference to existing drawable object, can assign attributes.
bool fError
enable line, fill, marker, error showing
REntry & SetError(bool on=true)
std::string fLabel
label shown for the entry
std::string fDrawableId
drawable id, used only when display item
REntry & SetLabel(const std::string &lbl)
std::string fTitle
legend title
RLegend(const RPadPos &offset, const RPadExtent &size)
void CollectShared(Internal::RIOSharedVector_t &vect) override
std::unique_ptr< RDisplayItem > Display(const RDisplayContext &) override
hide I/O pointers when creating display item
std::vector< REntry > fEntries
list of entries which should be displayed
const std::string & GetTitle() const
RLegend & SetTitle(const std::string &title)
void AddEntry(const std::shared_ptr< RDrawable > &drawable, const std::string &lbl, const std::string &opt="")
RLegend(const std::string &title)
std::shared_ptr< RCustomDrawable > AddEntry(const std::string &lbl, const std::string &opt="")
void OnDisplayItemDestroyed(RDisplayItem *) const override
when display item destroyed - restore I/O pointers
An extent / size (horizontal and vertical) in a RPad.
A position (horizontal and vertical) in a RPad.
RAttrValue< RPadLength > offsetX
! offset X relative to selected frame or pad corner
RPave(const char *csstype)
RAttrValue< RPadLength > offsetY
! offset Y relative to selected frame or pad corner
RAttrValue< RPadLength > height
! pave height
RAttrValue< RPadLength > width
! pave width
std::vector< RIOSharedBase * > RIOSharedVector_t
Namespace for ROOT features in testing.
Small utility to parse cmdline options.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")