library: libGraf
#include "TPie.h"


class description - header file - source file
viewCVS header - viewCVS source

class TPie: public TNamed, public TAttText

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
TPie(const TH1* h)
TPie(const TPie&)
TPie(const char*, const char*, Int_t)
TPie(const char*, const char*, Int_t, Double_t*, Int_t* cols = 0, const char** lbls = "0")
TPie(const char*, const char*, Int_t, Float_t*, Int_t* cols = 0, const char** lbls = "0")
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tDistancetoPrimitive(Int_t px, Int_t py)
Int_tDistancetoSlice(Int_t, Int_t)
virtual voidDraw(Option_t* option = "l")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidExecuteEvent(Int_t, Int_t, Int_t)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
const char*GetEntryLabel(Int_t)
const char*GetFractionFormat()
virtual const char*TObject::GetIconName() const
const char*GetLabelFormat()
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
const char*GetPercentFormat()
virtual Short_tTAttText::GetTextAlign() const
virtual Float_tTAttText::GetTextAngle() const
virtual Color_tTAttText::GetTextColor() const
virtual Font_tTAttText::GetTextFont() const
virtual Float_tTAttText::GetTextSize() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
const char*GetValueFormat()
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual voidTAttText::Modify()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TPie&operator=(const TPie&)
virtual voidPaint(Option_t*)
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidTAttText::ResetAttText(Option_t* toption = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidSavePrimitive(ostream& out, Option_t* opts = "")
virtual voidTAttText::SaveTextAttributes(ostream& out, const char* name, Int_t alidef = 12, Float_t angdef = 0, Int_t coldef = 1, Int_t fondef = 61, Float_t sizdef = 1)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCircle(Double_t x = .5, Double_t y = .5, Double_t rad = .4)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
voidSetEntryFillColor(Int_t, Int_t)
voidSetEntryFillStyle(Int_t, Int_t)
voidSetEntryLabel(Int_t, const char* text = "Slice")
voidSetEntryLineColor(Int_t, Int_t)
voidSetEntryLineStyle(Int_t, Int_t)
voidSetEntryLineWidth(Int_t, Int_t)
voidSetEntryRadiusOffset(Int_t, Double_t)
voidSetEntryVal(Int_t, Double_t)
voidSetFractionFormat(const char*)
voidSetHeight(Double_t val = 0.08)
voidSetLabel(const char*)
voidSetLabelFormat(const char*)
voidSetLabels(const char**)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetPercentFormat(const char*)
virtual voidTAttText::SetTextAlign(Short_t align = 11)
virtual voidTAttText::SetTextAngle(Float_t tangle = 0)
virtual voidTAttText::SetTextAttributes()
virtual voidTAttText::SetTextColor(Color_t tcolor = 1)
virtual voidTAttText::SetTextFont(Font_t tfont = 62)
virtual voidTAttText::SetTextSize(Float_t tsize = 1)
virtual voidTAttText::SetTextSizePixels(Int_t npixels)
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetValueFormat(const char*)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidInit(Int_t np, Double_t ao, Double_t x, Double_t y, Double_t r)
voidMakeSlices(Bool_t force = kFALSE)

Data Members

enum TObject::EStatusBits { kCanDelete
enum TObject::[unnamed] { kIsOnHeap
Double_tfXX coordinate of the pie centre
Double_tfYY coordinate of the pie centre
Double_tfRadiusPie radius
Double_tfAngularOffsetOffset angular offset for the first slice
Float_tfLabelsOffsetLabelsOffset offset of label
TStringfLabelFormatFormat format of the slices' label
TStringfValueFormatVform numeric format for the value
TStringfFractionFormatRform numeric format for the fraction of a slice
TStringfPercentFormatPfrom numeric format for the percent of a slice
Int_tfNvalsNumber of elements
Double_t*fVals[fNvals] Elements' values
TString*fLabels[fNvals] Labels
Int_t*fFillColors[fNvals] Slice fill color
Int_t*fFillStyles[fNvals] Slive fill style
Int_t*fLineColors[fNvals] Slice outline color
Int_t*fLineStyles[fNvals] Line style
Int_t*fLineWidths[fNvals] Line width
Double_t*fRadiusOffsets[fNvals] Distance of a slice from the center
Bool_tfIs3D! true if the pseudo-3d is enabled
Double_tfHeightPheight height of the slice
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
Float_tTAttText::fTextAngleText angle
Float_tTAttText::fTextSizeText size
Short_tTAttText::fTextAlignText alignment
Color_tTAttText::fTextColorText color index
Font_tTAttText::fTextFontText font number
Float_tfSum!Sum for the slice values
Float_t*fSlices!Subdivisions of the slices

Class Description

 Draw a Pie Chart

 The macro $ROOTSYS/tutorials/graphics/piechart.C produces the following
/* */

 Default constructor.
TPie(const char *name, const char *title, Int_t npoints)
 This constructor creates a pie chart when only the number of
 the slices is known. The number of slices is fixed.
TPie(const char *name, const char *title, Int_t npoints, Double_t *vals, Int_t *colors, const char *lbls[])
 Normal constructor. The 1st and 2nd parameters are the name of the object
 and its title.

 The number of points passed at this point is used to allocate the memory.

 Slices values are given as Double_t.

 The 4th elements is an array containing, in double precision format,
 the value of each slice. It is also possible to specify the filled color
 of each slice. If the color array is not specfied the slices are colored
 using a color sequence in the standard palette.
TPie(const char *name, const char *title, Int_t npoints, Float_t *vals, Int_t *colors, const char *lbls[])
 Normal constructor (Float_t).
TPie(const TH1 *h)
 Constructor from a TH1
TPie(const TPie &cpy)
 Copy constructor.
Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Evaluate the distance to the chart in gPad.
Int_t DistancetoSlice(Int_t px, Int_t py)
 Returns the slice number at the pixel position (px,py).
 Returns -1 if no slice is picked.

 Used by DistancetoPrimitive.
void Draw(Option_t *option)
 Draw the pie chart.

 The possible options are listed in the TPie::Paint() method.
void DrawGhost()
 This method is for internal use. It is used by Execute event to draw the
 outline of "this" TPie. Used when the opaque movements are not permitted.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute the mouse events.
const char* GetEntryLabel(Int_t i)
 Returns the label of the entry number "i".
Int_t GetEntryFillColor(Int_t i)
 Return the color of the slice number "i".
Int_t GetEntryFillStyle(Int_t i)
 Return the style use to fill the slice number "i".
Double_t GetEntryRadiusOffset(Int_t i)
 Return the radial offset's value for the slice number "i".
Double_t GetEntryVal(Int_t i)
 Return the value associated with the slice number "i".
void Init(Int_t np, Double_t ao, Double_t x, Double_t y, Double_t r)
 Common initialization for all constructors.
 This is a private function called to allocate the memory.
void Paint(Option_t *option)
 Paint a Pie chart in a canvas.
 The possible option are:

 "R"   Print the labels along the central "R"adius of slices.
 "T"   Print the label in a direction "T"angent to circle that describes
       the TPie.
 "3D"  Draw the pie-chart with a pseudo 3D effect.
 "NOL" No OutLine: Don't draw the slices' outlines, any property over the
       slices' line is ignored.

 Other options changing the labels' format are described in
void SavePrimitive(ostream &out, Option_t *option)
 Save primitive as a C++ statement(s) on output stream out
void SetCircle(Double_t x, Double_t y, Double_t rad)
 Set the coordinates of the circle that describe the pie:
 - the 1st and the 2nd arguments are the x and y center's coordinates.
 - the 3rd value is the pie-chart's radius.

 All the coordinates are in NDC space.
void SetEntryLabel(Int_t i, const char *text)
 Set slice number "i" label. The first parameter is the index of the slice,
 the other is the label text.
void SetEntryLineColor(Int_t i, Int_t color)
 Set the color for the slice's outline. "i" is the slice number.
void SetEntryLineStyle(Int_t i, Int_t style)
 Set the style for the slice's outline. "i" is the slice number.
void SetEntryLineWidth(Int_t i, Int_t width)
 Set the width of the slice's outline. "i" is the slice number.
void SetEntryFillColor(Int_t i, Int_t color)
 Set the color for the slice "i".
void SetEntryFillStyle(Int_t i, Int_t style)
 Set the fill style for the "i" slice
void SetEntryRadiusOffset(Int_t i, Double_t shift)
 Set the distance, in the direction of the radius of the slice.
void SetEntryVal(Int_t i, Double_t val)
 Set the value of a slice
void SetFillColors(Int_t *colors)
 Set the fill colors for all the TPie's slices.
void SetHeight(Double_t val)
 Set the height of the piechart if plotted in pseudo-3d mode.
void SetLabel(const char *txt)
 Set the label for the slice under the mouse pointer,
 this method is useful only when used in the GUI, not
 in macros.
void SetLabelFormat(const char *fmt)
 This method is used to customize the label format. The format string
 must contain one of these modifiers:

 - %txt  : to print the text label associated with the slice
 - %val  : to print the numeric value of the slice
 - %frac : to print the relative fraction of this slice
 - %perc : to print the % of this slice

 ex. : mypie->SetLabelFormat("%txt (%frac)");
void SetFractionFormat(const char *fmt)
 Set numeric format in the label, is used if the label format
 there is the modifier %frac, in this case the value is printed
 using this format.

 The numeric format use the standard C modifier used in stdio library:
 %f, %2.1$, %e... for further documentation you can use the printf
 mapage ("man 3 printf" on linux)

 ex. : mypie->SetLabelFormat("%txt (%frac)");
void SetLabels(const char *lbls[])
 Set the labels for all the slices.
void SetLabelsOffset(Float_t labelsoffset)
 Set the distance between the label end the external line of the TPie.
void SetAngularOffset(Double_t offset)
 Set the global angular offset for slices in degree [0,360]
void SetPercentFormat(const char *fmt)
 Set the numeric format for the percent value of a slice, default: %3.1f
void SetRadius(Double_t rad)
 Set the pie chart's radius' value.
void SetValueFormat(const char *fmt)
 Set the numeric format the slices' values.
 Used by %val (see SetLabelFormat()).
void SetX(Double_t x)
 Set X value.
void SetY(Double_t y)
 Set Y value.
void MakeSlices(Bool_t force)
 Make the slices.
 If they already exist it does nothing unless force=kTRUE.
Double_t GetAngularOffset()
{ return fAngularOffset; }
Double_t GetHeight()
{ return fHeight; }
const char * GetFractionFormat()
{ return fFractionFormat.Data(); }
const char * GetLabelFormat()
{ return fLabelFormat.Data(); }
Float_t GetLabelsOffset()
{ return fLabelsOffset; }
const char * GetPercentFormat()
{ return fPercentFormat.Data(); }
Double_t GetRadius()
{ return fRadius;}
const char * GetValueFormat()
{ return fValueFormat.Data(); }
Double_t GetX()
{ return fX; }
Double_t GetY()
{ return fY; }

Author: Guido Volpi, Olivier Couet 03/11/2006
Last update: root/graf:$Name: $:$Id: TPie.cxx,v 1.11 2006/12/12 13:39:19 couet Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

ROOT page - Class index - Class Hierarchy - 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.