TLegend


class description - source file - inheritance tree

class TLegend : public TPave, public TAttText


    public:
TLegend TLegend() TLegend TLegend(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const char* header, Option_t* option = "brNDC") TLegend TLegend(const TLegend& legend) virtual void ~TLegend() TLegendEntry* AddEntry(TObject* obj, const char* label, Option_t* option = "lpf") TLegendEntry* AddEntry(const char* name, const char* label, Option_t* option = "lpf") static TClass* Class() virtual void Clear(Option_t* option) virtual void Copy(TObject& obj) virtual void DeleteEntry() virtual void Draw(Option_t* option) virtual void EditEntryAttFill() virtual void EditEntryAttLine() virtual void EditEntryAttMarker() virtual void EditEntryAttText() TLegendEntry* GetEntry() const Float_t GetEntrySeparation() const virtual const char* GetHeader() const TList* GetListOfPrimitives() const Float_t GetMargin() const virtual void InsertEntry(const char* objectName, const char* label, Option_t* option = "lpf") virtual TClass* IsA() const virtual void Paint(Option_t* option) virtual void PaintPrimitives() virtual void Print(Option_t* option) const virtual void RecursiveRemove(TObject* obj) virtual void SavePrimitive(ofstream& out, Option_t* option) void SetDefaults() virtual void SetEntryLabel(const char* label) virtual void SetEntryOption(Option_t* option) void SetEntrySeparation(Float_t entryseparation) virtual void SetHeader(const char* header) void SetMargin(Float_t margin) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
TList* fPrimitives list of TLegendEntries Float_t fEntrySeparation separation between entries, as a fraction of Float_t fMargin fraction of total width used for symbol

Class Description

 TLegend   Matthew.Adam.Dobbs@Cern.CH, September 1999
 Legend of markers/lines/boxes to represent objects with marker/line/fill
   attributes
   (the methods employed are very similar to those in TPaveText class)


TLegend(): TPave(), TAttText()
 TPadLegend do-nothing default constructor

TLegend( Double_t x1, Double_t y1,Double_t x2, Double_t y2, const char *header, Option_t *option) :TPave(x1,y1,x2,y2,4,option), TAttText(12,0,1,42,0)
___________________________________
 TLegend normal Contructor
 A TLegend is a Pave with several TLegendEntry(s)
 The pave is defined with default coords, bordersize and option
 x1,y1,x2,y2 are the coordinates of the Legend in the current pad
 (in NDC by default!)
 text is left adjusted and vertically centered = 12
      Angle=0 (degrees), color=1 (black)
      helvetica-medium-r-normal scalable font = 42
      (will use bold = 62 for header)
      size =0 (calculate this later when number of entries is known)
 header is the "title" that will be displayed at the top of the legend
   it is treated like a regular entry and supports TLatex. The default
   is no header (header = 0).
 Options are the same as for TPave Default = "brNDC"

 Here's an example of a Legend created with TLegend

  /*
    
  */


 The Legend part of this plot was created as follows:

    leg = new TLegend(0.4,0.6,0.89,0.89);
    leg->AddEntry(fun1,"One Theory","l");
    leg->AddEntry(fun3,"Another Theory","f");
    leg->AddEntry(gr,"The Data","p");
    leg->Draw();
    // oops we forgot the blue line... add it after
    leg->AddEntry(fun2,"#sqrt{2#pi} P_{T} (#gamma)  latex formula","f");
    // and add a header (or "title") for the legend
    leg->SetHeader("The Legend Title");
    leg->Draw();

 where fun1,fun2,fun3 and gr are pre-existing functions and graphs

 You can edit the TLegend by right-clicking on it.


TLegend( const TLegend &legend ) : TPave(legend), TAttText(legend)
 copy constuctor

~TLegend()
 TLegend default destructor

TLegendEntry* AddEntry(TObject *obj, const char *label, Option_t *option)
 Add a new entry to this legend
 obj is the object to be represented
 label is the text you wish to associate with obj in the legend
 Options are:
    L draw line associated w/ TAttLine if obj inherits from TAttLine
    P draw polymarker assoc. w/ TAttMarker if obj inherits from TAttMarker
    F draw a box with fill associated w/ TAttFill if obj inherits TAttFill


TLegendEntry* AddEntry(const char *name, const char *label, Option_t *option)
 Add a new entry to this legend
 name is the name of an object in the pad to be represented
 label is the text you wish to associate with obj in the legend
 Options are:
    L draw line associated w/ TAttLine if obj inherits from TAttLine
    P draw polymarker assoc. w/ TAttMarker if obj inherits from TAttMarker
    F draw a box with fill associated w/ TAttFill if obj inherits TAttFill


void Clear( Option_t *)
 Clear all entries in this legend --- including the header!

void Copy( TObject &obj )
 copy this legend into obj

void DeleteEntry()
 Delete entry at the mouse position

void Draw( Option_t *option )
 Draw this legend with its current attributes

void EditEntryAttFill()
 Edit the fill attributes for the entry pointed to be the mouse

void EditEntryAttLine()
 Edit the line attributes for the entry pointed to be the mouse

void EditEntryAttMarker()
 Edit the marker attributes for the entry pointed to be the mouse

void EditEntryAttText()
 Edit the text attributes for the entry pointed to be the mouse

TLegendEntry* GetEntry() const
 Get entry pointed to by the mouse
 This method is mostly a tool for other methods inside this class

const char* GetHeader() const
 returns the header, which is the title that appears at the top
  of the legend

void InsertEntry( const char* objectName, const char* label, Option_t* option)
 Add a new entry before the entry at the mouse position

void Paint( Option_t* option )
 Paint this legend with its current attributes

void PaintPrimitives()
 Paint the entries (list of primitives) for this legend

 NOTE: if we want an     Int_t mode
       it can be added later... but I understand whyaas

void Print( Option_t* option ) const
 dump this TLegend and its contents

void RecursiveRemove(TObject *obj)
  Reset TLegendEntrys pointing to obj

void SavePrimitive( ofstream &out, Option_t* )
 Save this legend as C++ statements on output stream out
  to be used with the SaveAs .C option

void SetEntryLabel( const char* label )
 edit the label of the entry pointed to by the mouse

void SetEntryOption( Option_t* option )
 edit the option of the entry pointed to by the mouse

void SetHeader( const char *header )
 Sets the header, which is the "title" that appears at the top of the
  TLegend



Inline Functions


            Float_t GetEntrySeparation() const
             TList* GetListOfPrimitives() const
            Float_t GetMargin() const
               void SetDefaults()
               void SetEntrySeparation(Float_t entryseparation)
               void SetMargin(Float_t margin)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)


Author: Matthew.Adam.Dobbs 06/09/99
Last update: root/graf:$Name: $:$Id: TLegend.cxx,v 1.14 2002/05/18 08:21:59 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.