00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TPie
00013 #define ROOT_TPie
00014 #ifndef ROOT_TObject
00015 #include "TObject.h"
00016 #endif
00017 #ifndef ROOT_TNamed
00018 #include <TNamed.h>
00019 #endif
00020 #ifndef ROOT_TString
00021 #include <TString.h>
00022 #endif
00023 #ifndef ROOT_TAttText
00024 #include <TAttText.h>
00025 #endif
00026
00027 class TH1;
00028 class TPieSlice;
00029 class TLegend;
00030
00031 class TPie : public TNamed , public TAttText {
00032 private:
00033 void Init(Int_t np, Double_t ao, Double_t x, Double_t y, Double_t r);
00034 void DrawGhost();
00035
00036 Float_t fSum;
00037 Float_t *fSlices;
00038 TLegend *fLegend;
00039
00040 protected:
00041 Double_t fX;
00042 Double_t fY;
00043 Double_t fRadius;
00044 Double_t fAngularOffset;
00045 Float_t fLabelsOffset;
00046 TString fLabelFormat;
00047 TString fValueFormat;
00048 TString fFractionFormat;
00049 TString fPercentFormat;
00050 Int_t fNvals;
00051 TPieSlice **fPieSlices;
00052 Bool_t fIs3D;
00053 Double_t fHeight;
00054 Float_t fAngle3D;
00055
00056 public:
00057 TPie();
00058 TPie(const char *,const char *, Int_t);
00059 TPie(const char *,const char *, Int_t, Double_t *,Int_t *cols=0, const char *lbls[]=0);
00060 TPie(const char *,const char *, Int_t, Float_t *,Int_t *cols=0, const char *lbls[]=0);
00061 TPie(const TH1 *h);
00062 TPie(const TPie&);
00063 ~TPie();
00064
00065 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
00066 Int_t DistancetoSlice(Int_t,Int_t);
00067 virtual void Draw(Option_t *option="l");
00068 virtual void ExecuteEvent(Int_t,Int_t,Int_t);
00069 Float_t GetAngle3D() { return fAngle3D; }
00070 Double_t GetAngularOffset() { return fAngularOffset; }
00071 Int_t GetEntryFillColor(Int_t);
00072 Int_t GetEntryFillStyle(Int_t);
00073 const char* GetEntryLabel(Int_t);
00074 Int_t GetEntryLineColor(Int_t);
00075 Int_t GetEntryLineStyle(Int_t);
00076 Int_t GetEntryLineWidth(Int_t);
00077 Double_t GetEntryRadiusOffset(Int_t);
00078 Double_t GetEntryVal(Int_t);
00079 const char *GetFractionFormat() { return fFractionFormat.Data(); }
00080 Double_t GetHeight() { return fHeight; }
00081 const char *GetLabelFormat() { return fLabelFormat.Data(); }
00082 Float_t GetLabelsOffset() { return fLabelsOffset; }
00083 TLegend *GetLegend();
00084 Int_t GetEntries() { return fNvals; }
00085 const char *GetPercentFormat() { return fPercentFormat.Data(); }
00086 Double_t GetRadius() { return fRadius;}
00087 TPieSlice *GetSlice(Int_t i);
00088 const char *GetValueFormat() { return fValueFormat.Data(); }
00089 Double_t GetX() { return fX; }
00090 Double_t GetY() { return fY; }
00091 TLegend *MakeLegend(Double_t x1=.65,Double_t y1=.65,Double_t x2=.95, Double_t y2=.95, const char *leg_header="");
00092 void MakeSlices(Bool_t force=kFALSE);
00093 virtual void Paint(Option_t *);
00094 void SavePrimitive(ostream &out, Option_t *opts="");
00095 void SetAngle3D(Float_t val = 30.);
00096 void SetAngularOffset(Double_t);
00097 void SetCircle(Double_t x=.5, Double_t y=.5, Double_t rad=.4);
00098 void SetEntryLabel(Int_t, const char *text="Slice");
00099 void SetEntryLineColor(Int_t, Int_t);
00100 void SetEntryLineStyle(Int_t, Int_t);
00101 void SetEntryLineWidth(Int_t, Int_t);
00102 void SetEntryFillColor(Int_t, Int_t);
00103 void SetEntryFillStyle(Int_t, Int_t);
00104 void SetEntryRadiusOffset(Int_t, Double_t);
00105 void SetEntryVal(Int_t, Double_t);
00106 void SetFillColors(Int_t*);
00107 void SetFractionFormat(const char*);
00108 void SetHeight(Double_t val=.08);
00109 void SetLabelFormat(const char *);
00110 void SetLabels(const char *[]);
00111 void SetLabelsOffset(Float_t);
00112 void SetPercentFormat(const char *);
00113 void SetRadius(Double_t);
00114 void SetValueFormat(const char *);
00115 void SetX(Double_t);
00116 void SetY(Double_t);
00117 void SortSlices(Bool_t amode=kTRUE,Float_t merge_thresold=.0);
00118
00119 ClassDef(TPie,1)
00120 };
00121
00122 #endif // ROOT_TPie