63 Init(1, 0, 0.5, 0.5, 0.4);
73 Init(npoints, 0, 0.5, 0.5, 0.4);
93 Init(npoints, 0, 0.5, 0.5, 0.4);
108 Init(npoints, 0, 0.5, 0.5, 0.4);
125 Int_t np = last-first+1;
126 Init(np, 0, 0.5, 0.5, 0.4);
234 if ( ((ang>=phimin && ang <= phimax) || (phimax>
TMath::TwoPi() &&
245 if (dist<.95 && dist>.65) {
254 if (lang/range<.25 || rang/range<.25) {
279 if (soption.
Length()==0) soption =
"l";
282 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
285 gPad->Range(0.,0.,1.,1.);
321 Double_t dphi = (maxphi-minphi)/ndiv;
323 if (dphi>.15) ndiv = (
Int_t) ((maxphi-minphi)/.15);
324 dphi = (maxphi-minphi)/ndiv;
327 for (
Int_t j=0;j<ndiv;++j) {
331 gPad->XtoAbsPixel(x0+
gRadius*TMath::Cos(phi+dphi)),
337 gPad->XtoAbsPixel(x0),
gPad->YtoAbsPixel(y0) );
340 gPad->YtoAbsPixel(y0),
341 gPad->XtoAbsPixel(x0),
342 gPad->YtoAbsPixel(y0+fHeight));
370 Double_t dphi = (maxphi-minphi)/ndiv;
372 if (dphi>.15) ndiv = (
Int_t) ((maxphi-minphi)/.15);
373 dphi = (maxphi-minphi)/ndiv;
376 for (
Int_t j=0;j<ndiv;++j) {
380 gPad->XtoAbsPixel(x0+
gRadius*TMath::Cos(phi+dphi)),
386 gPad->XtoAbsPixel(x0),
gPad->YtoAbsPixel(y0) );
405 static bool isMovingPie(
kFALSE);
406 static bool isMovingSlice(
kFALSE);
407 static bool isResizing(
kFALSE);
408 static bool isRotating(
kFALSE);
409 static bool onBorder(
kFALSE);
411 static Int_t prev_event(-1);
412 static Int_t oldpx, oldpy;
456 && !isMovingPie && !isMovingSlice && !isResizing) {
480 }
else if (gCurrent_rad<=fRadius*.6 && gCurrent_rad>=
fRadius*.3) {
486 if (isMovingPie || isMovingSlice)
gPad->SetCursor(
kMove);
491 if (!isMovingSlice || !isMovingPie || !isResizing || !isRotating) {
496 isMovingSlice =
kTRUE;
499 }
else if (gCurrent_rad<fRadius*.6 && gCurrent_rad>
fRadius*.3) {
508 mdx =
gPad->PixeltoX(dx);
509 mdy =
gPad->PixeltoY(dy);
511 if (isMovingPie || isMovingSlice) {
531 }
else if (isResizing) {
542 }
else if (isRotating) {
562 if ( ((isMovingPie || isMovingSlice || isRotating) &&
gPad->OpaqueMoving()) ||
563 (isResizing &&
gPad->OpaqueResizing()) ) {
575 if (
gROOT->IsEscaped()) {
588 if (isRedrawing && (isMovingPie || isMovingSlice))
gPad->SetCursor(
kMove);
590 if (isMovingPie) isMovingPie =
kFALSE;
591 if (isMovingSlice) isMovingSlice =
kFALSE;
592 if (isResizing) isResizing =
kFALSE;
615 event =
gVirtualX->RequestLocator(1, 1, px, py);
825 if ( (idx=soption.
Index(
"same"))>=0 ) {
830 if ( (idx=soption.
Index(
"nol"))>=0 ) {
835 if ( (idx=soption.
Index(
"sc"))>=0 ) {
836 optionSameColor =
kTRUE;
841 if ( (idx=soption.
Index(
"3d"))>=0 ) {
849 if ( (idx=soption.
Index(
"t"))>=0 ) {
855 if ( (idx=soption.
Index(
"r"))>=0 ) {
861 if ( (idx=soption.
Index(
">"))>=0 ) {
867 if ( (idx=soption.
Index(
"<"))>=0 ) {
878 Warning(
"Paint",
"No valid arrays of values");
911 if (optionLine==
kTRUE) {
929 if (optionLine==
kTRUE) {
951 if (optionLine==
kTRUE) {
1016 }
else if (lblor==2) {
1033 if (aphi<0) ly -=
h;
1037 if (rphi < 0 && fIs3D && label_off>=0.)
1050 if (optionSame)
return;
1055 if ((obj =
gPad->GetListOfPrimitives()->FindObject(
"title"))) {
1061 if (title)
delete title;
1069 if (ht<=0) ht = 0.05;
1091 if (talh < 1) talh = 1;
else if (talh > 3) talh = 3;
1093 if (talv < 1) talv = 1;
else if (talv > 3) talv = 3;
1097 if (talh == 2) xpos = xpos-wt/2.;
1098 if (talh == 3) xpos = xpos-wt;
1099 if (talv == 2) ypos = ypos+ht/2.;
1100 if (talv == 1) ypos = ypos+ht;
1102 title =
new TPaveText(xpos,ypos-ht,xpos+wt,ypos,
"blNDC");
1125 out <<
" " << std::endl;
1132 <<
"\", " <<
fNvals <<
");" << std::endl;
1133 out <<
" " <<
GetName() <<
"->SetCircle(" <<
fX <<
", " <<
fY <<
", " 1134 <<
fRadius <<
");" << std::endl;
1136 <<
"\");" << std::endl;
1138 <<
"\");" << std::endl;
1140 <<
"\");" << std::endl;
1142 <<
");" << std::endl;
1144 <<
");" << std::endl;
1153 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetTitle(\"" 1155 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetValue(" 1157 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetRadiusOffset(" 1159 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetFillColor(" 1161 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetFillStyle(" 1163 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetLineColor(" 1165 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetLineStyle(" 1167 out <<
" " <<
GetName() <<
"->GetSlice(" << i <<
")->SetLineWidth(" 1171 out <<
" " <<
GetName() <<
"->Draw(\"" << option <<
"\");" << std::endl;
1180 while (val>360.) val -= 360.;
1181 while (val<0) val += 360.;
1182 if (val>=90 && val<180) val = 180-val;
1183 else if (val>=180 && val<=360) val = 360-val;
1288 if (!colors)
return;
1373 "It's not possible set the radius to a negative value");
1408 if (
fSlices && !force)
return;
1415 "Negative values in TPie, absolute value will be used");
1421 if (
fSum<=.0)
return;
1465 if (merge_threshold>0) {
1484 delete merged_slice;
1490 new_array[0] = merged_slice;
1491 for (
Int_t i=0;i<old_fNvals;++i) {
1508 delete merged_slice;
1514 new_array[
fNvals-1] = merged_slice;
1515 for (
Int_t i=old_fNvals-1;i>=0;--i) {
virtual void Clear(Option_t *option="")
Clear all entries in this legend, including the header.
virtual const char * GetName() const
Returns name of object.
const char * GetLabelFormat()
Int_t GetEntryFillColor(Int_t)
Return the color of the slice number "i".
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
double dist(Rotation3D const &r1, Rotation3D const &r2)
void SetPercentFormat(const char *)
Set the numeric format for the percent value of a slice, default: %3.1f.
Style_t GetTitleFont(Option_t *axis="X") const
Return title font.
void MakeSlices(Bool_t force=kFALSE)
Make the slices.
TString fFractionFormat
Rform numeric format for the fraction of a slice.
virtual void SetName(const char *name="")
virtual void PaintEllipse(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, Double_t theta, Option_t *option="")
Draw this ellipse with new coordinates.
const char * GetBinLabel(Int_t bin) const
Return label for bin.
virtual void Draw(Option_t *option="")
Draw this pavetext with its current attributes.
void DrawGhost()
This method is for internal use.
Int_t GetFirst() const
Return first bin on the axis i.e.
static constexpr double pi
This class displays a legend box (TPaveText) containing several legend entries.
Color_t GetTitleTextColor() const
virtual Color_t GetTextColor() const
Return the text color.
Float_t * fSlices
!Subdivisions of the slices
virtual void SetX2NDC(Double_t x2)
constexpr Double_t TwoPi()
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
TString & ReplaceAll(const TString &s1, const TString &s2)
static Int_t GetColorDark(Int_t color)
Static function: Returns the dark color number corresponding to n If the TColor object does not exist...
R__EXTERN TStyle * gStyle
Int_t fNvals
Number of elements.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
void SavePrimitive(std::ostream &out, Option_t *opts="")
Save primitive as a C++ statement(s) on output stream out.
const char * GetValueFormat()
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Float_t GetTextAngle() const
Return the text angle.
Int_t GetEntryLineColor(Int_t)
Return the line color used to outline thi "i" slice.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void SetAngularOffset(Double_t)
Set the global angular offset for slices in degree [0,360].
TLegend * fLegend
!Legend for this piechart
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Short_t Min(Short_t a, Short_t b)
void ToLower()
Change string to lower-case.
TPieSlice * GetSlice(Int_t i)
Return the reference to the slice of index 'id'.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual Float_t GetLabelSize() const
void SetEntryFillStyle(Int_t, Int_t)
Set the fill style for the "i" slice.
Float_t GetTitleY() const
static constexpr double rad
Double_t fRadius
Radius Pie radius.
virtual Width_t GetLineWidth() const
Return the line width.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Float_t fSum
!Sum for the slice values
if object in a list can be deleted
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetAngle3D(Float_t val=30.)
Set the value of for the pseudo 3D view angle, in degree.
void SetEntryVal(Int_t, Double_t)
Set the value of a slice.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual Style_t GetLineStyle() const
Return the line style.
Int_t GetEntryLineStyle(Int_t)
Return the style used to outline thi "i" slice.
static const double x2[5]
Double_t GetYsize()
Return size of the formula along Y in pad coordinates.
virtual void Paint(Option_t *)
Paint a Pie chart in a canvas.
Float_t GetTitleFontSize() const
Int_t GetEntryFillStyle(Int_t)
Return the style use to fill the slice number "i".
virtual void Paint(Option_t *option="")
Paint this pavetext with its current attributes.
The TNamed class is the base class for all named ROOT classes.
virtual Float_t GetTextSize() const
Return the text size.
Double_t GetEntryRadiusOffset(Int_t)
Return the radial offset's value for the slice number "i".
To draw Mathematical Formula.
THashList * GetLabels() const
void SetEntryRadiusOffset(Int_t, Double_t)
Set the distance, in the direction of the radius of the slice.
void SetHeight(Double_t val=.08)
Set the height, in pixel, for the piechart if is drawn using the pseudo-3d mode.
TString fPercentFormat
Pfrom numeric format for the percent of a slice.
A slice of a piechart, see the TPie class.
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
Base class for several text objects.
Float_t GetTitleX() const
const char * GetEntryLabel(Int_t)
Returns the label of the entry number "i".
constexpr Double_t PiOver4()
Double_t fY
Y coordinate of the pie centre.
Double_t ATan2(Double_t, Double_t)
Float_t fLabelsOffset
LabelsOffset offset of label.
void SetRadiusOffset(Double_t)
Set the radial offset of this slice.
Double_t GetAngularOffset()
Int_t GetColorPalette(Int_t i) const
Return color number i in current palette.
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
Double_t GetEntryVal(Int_t)
Return the value associated with the slice number "i".
virtual Color_t GetLabelColor() const
Bool_t fIs3D
! true if the pseudo-3d is enabled
Int_t DistancetoSlice(Int_t, Int_t)
Returns the slice number at the pixel position (px,py).
void SetX(Double_t)
Set X value.
virtual void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
void SetFractionFormat(const char *)
Set numeric format in the label, is used if the label format there is the modifier frac...
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Double_t GetX1NDC() const
Int_t GetLast() const
Return last bin on the axis i.e.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Evaluate the distance to the chart in gPad.
Double_t GetXsize()
Return size of the formula along X in pad coordinates.
Class to manage histogram axis.
Float_t GetTitleH() const
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void SetLabels(const char *[])
Set the labels for all the slices.
virtual Font_t GetTextFont() const
Return the text font.
void SetY(Double_t)
Set Y value.
char * Form(const char *fmt,...)
void SortSlices(Bool_t amode=kTRUE, Float_t merge_thresold=.0)
This method, mainly intended for internal use, ordered the slices according their values...
TString fValueFormat
Vform numeric format for the value.
void SetValue(Double_t)
Set the value for this slice.
void SetFillColors(Int_t *)
Set the fill colors for all the TPie's slices.
void SetCircle(Double_t x=.5, Double_t y=.5, Double_t rad=.4)
Set the coordinates of the circle that describe the pie:
Color_t GetTitleFillColor() const
virtual Color_t GetLineColor() const
Return the line color.
Float_t fAngle3D
The angle of the pseudo-3d view.
virtual void ExecuteEvent(Int_t, Int_t, Int_t)
Execute the mouse events.
TString & Remove(Ssiz_t pos)
Width_t GetTitleBorderSize() const
Float_t GetTitleW() const
TString fLabelFormat
Format format of the slices' label.
static const double x1[5]
A Pave (see TPave) with text, lines or/and boxes inside.
void SetRadius(Double_t)
Set the pie chart's radius' value.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
TPieSlice ** fPieSlices
[fNvals] Slice array of this pie-chart
TPie()
Default constructor.
virtual Color_t GetFillColor() const
Return the fill area color.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t GetValue()
Return the value of this slice.
TLegend * MakeLegend(Double_t x1=.65, Double_t y1=.65, Double_t x2=.95, Double_t y2=.95, const char *leg_header="")
This method create a legend that explains the contents of the slice for this pie-chart.
void SetLabelsOffset(Float_t)
Set the distance between the label end the external line of the TPie.
Double_t fHeight
Height of the slice in pixel.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Double_t fX
X coordinate of the pie centre.
Double_t fAngularOffset
Offset angular offset for the first slice.
void SetLabelFormat(const char *)
This method is used to customize the label format.
void SetEntryFillColor(Int_t, Int_t)
Set the color for the slice "i".
Mother of all ROOT objects.
void SetEntryLineStyle(Int_t, Int_t)
Set the style for the slice's outline. "i" is the slice number.
Double_t GetRadiusOffset()
return the value of the offset in radial direction for this slice.
Short_t Max(Short_t a, Short_t b)
TLegend * GetLegend()
If created before by Paint option or by MakeLegend method return the pointer to the legend...
Float_t GetLabelsOffset()
void SetEntryLineColor(Int_t, Int_t)
Set the color for the slice's outline. "i" is the slice number.
const char * GetPercentFormat()
Float_t GetLabelOffset(Option_t *axis="X") const
Return label offset.
Int_t GetEntryLineWidth(Int_t)
Return the line width used to outline thi "i" slice.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
void Init(Int_t np, Double_t ao, Double_t x, Double_t y, Double_t r)
Common initialization for all constructors.
Style_t GetTitleStyle() const
virtual Style_t GetFillStyle() const
Return the fill area style.
Double_t Sqrt(Double_t x)
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
void SetIsActive(Bool_t is)
void SetEntryLineWidth(Int_t, Int_t)
Set the width of the slice's outline. "i" is the slice number.
virtual void Draw(Option_t *option="l")
Draw the pie chart.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
void SetEntryLabel(Int_t, const char *text="Slice")
Set slice number "i" label.
constexpr Double_t PiOver2()
virtual void SetBorderSize(Int_t bordersize=4)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual Style_t GetLabelFont() const
virtual const char * GetTitle() const
Returns title of object.
Int_t GetOptTitle() const
const char * Data() const
void SetValueFormat(const char *)
Set the numeric format the slices' values.