Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TPie.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/graf:$Id$
0002 // Author: Guido Volpi, Olivier Couet  03/11/2006
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TPie
0013 #define ROOT_TPie
0014 
0015 #include <TNamed.h>
0016 #include <TAttText.h>
0017 #include <TString.h>
0018 
0019 class TH1;
0020 class TPieSlice;
0021 class TLegend;
0022 
0023 class TPie : public TNamed , public TAttText {
0024 private:
0025    void Init(Int_t np, Double_t ao, Double_t x, Double_t y, Double_t r);
0026    void DrawGhost();
0027 
0028    Float_t  fSum;             ///<!Sum for the slice values
0029    Float_t *fSlices{nullptr}; ///<!Subdivisions of the slices
0030    TLegend *fLegend{nullptr}; ///<!Legend for this piechart
0031 
0032 protected:
0033    Double_t    fX;              ///< X coordinate of the pie centre
0034    Double_t    fY;              ///< Y coordinate of the pie centre
0035    Double_t    fRadius;         ///< Radius Pie radius
0036    Double_t    fAngularOffset;  ///< Offset angular offset for the first slice
0037    Float_t     fLabelsOffset;   ///< LabelsOffset offset of label
0038    TString     fLabelFormat;    ///< Format format of the slices' label
0039    TString     fValueFormat;    ///< Vform numeric format for the value
0040    TString     fFractionFormat; ///< Rform numeric format for the fraction of a slice
0041    TString     fPercentFormat;  ///< Pfrom numeric format for the percent of a slice
0042    Int_t       fNvals;          ///< Number of elements
0043    TPieSlice **fPieSlices{nullptr}; ///<[fNvals] Slice array of this pie-chart
0044    Bool_t      fIs3D;           ///<! true if the pseudo-3d is enabled
0045    Double_t    fHeight;         ///< Height of the slice in pixel
0046    Float_t     fAngle3D;        ///< The angle of the pseudo-3d view
0047 
0048 public:
0049    TPie();
0050    TPie(const char *,const char *, Int_t);
0051    TPie(const char *,const char *, Int_t, Double_t *, Int_t *cols = nullptr, const char *lbls[] = nullptr);
0052    TPie(const char *,const char *, Int_t, Float_t *, Int_t *cols = nullptr, const char *lbls[] = nullptr);
0053    TPie(const TH1 *h);
0054    TPie(const TPie&);
0055    ~TPie() override;
0056 
0057    Int_t          DistancetoPrimitive(Int_t px, Int_t py) override;
0058    Int_t          DistancetoSlice(Int_t,Int_t);
0059    void           Draw(Option_t *option="l") override; // *MENU*
0060    void           ExecuteEvent(Int_t,Int_t,Int_t) override;
0061    Float_t        GetAngle3D() { return fAngle3D; }
0062    Double_t       GetAngularOffset() { return fAngularOffset; }
0063    Int_t          GetEntryFillColor(Int_t);
0064    Int_t          GetEntryFillStyle(Int_t);
0065    const char*    GetEntryLabel(Int_t);
0066    Int_t          GetEntryLineColor(Int_t);
0067    Int_t          GetEntryLineStyle(Int_t);
0068    Int_t          GetEntryLineWidth(Int_t);
0069    Double_t       GetEntryRadiusOffset(Int_t);
0070    Double_t       GetEntryVal(Int_t);
0071    const char    *GetFractionFormat() { return fFractionFormat.Data(); }
0072    Double_t       GetHeight() { return fHeight; }
0073    const char    *GetLabelFormat() { return fLabelFormat.Data(); }
0074    Float_t        GetLabelsOffset() { return fLabelsOffset; }
0075    TLegend       *GetLegend();
0076    Int_t          GetEntries() { return fNvals; }
0077    const char    *GetPercentFormat() { return fPercentFormat.Data(); }
0078    Double_t       GetRadius() { return fRadius;}
0079    TPieSlice     *GetSlice(Int_t i);
0080    const char    *GetValueFormat() { return fValueFormat.Data(); }
0081    Double_t       GetX() { return fX; }
0082    Double_t       GetY() { return fY; }
0083    TLegend       *MakeLegend(Double_t x1=.65,Double_t y1=.65,Double_t x2=.95, Double_t y2=.95, const char *leg_header="");
0084    void           MakeSlices(Bool_t force=kFALSE);
0085    void           Paint(Option_t *) override;
0086    void           SavePrimitive(std::ostream &out, Option_t *opts="") override;
0087    void           SetAngle3D(Float_t val = 30.); // *MENU*
0088    void           SetAngularOffset(Double_t);
0089    void           SetCircle(Double_t x=.5, Double_t y=.5, Double_t rad=.4);
0090    void           SetEntryLabel(Int_t, const char *text="Slice");
0091    void           SetEntryLineColor(Int_t, Int_t);
0092    void           SetEntryLineStyle(Int_t, Int_t);
0093    void           SetEntryLineWidth(Int_t, Int_t);
0094    void           SetEntryFillColor(Int_t, Int_t);
0095    void           SetEntryFillStyle(Int_t, Int_t);
0096    void           SetEntryRadiusOffset(Int_t, Double_t);
0097    void           SetEntryVal(Int_t, Double_t);
0098    void           SetFillColors(Int_t*);
0099    void           SetFractionFormat(const char*); // *MENU*
0100    void           SetHeight(Double_t val=.08); // *MENU*
0101    void           SetLabelFormat(const char *); // *MENU*
0102    void           SetLabels(const char *[]);
0103    void           SetLabelsOffset(Float_t); // *MENU*
0104    void           SetPercentFormat(const char *); // *MENU*
0105    void           SetRadius(Double_t); // *MENU*
0106    void           SetValueFormat(const char *); // *MENU*
0107    void           SetX(Double_t); // *MENU*
0108    void           SetY(Double_t); // *MENU*
0109    void           SortSlices(Bool_t amode=kTRUE,Float_t merge_thresold=.0);
0110 
0111    ClassDefOverride(TPie,1) //Pie chart graphics class
0112 };
0113 
0114 #endif // ROOT_TPie