Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetLegendFillStyle #15737

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/base/inc/TStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class TStyle : public TNamed, public TAttLine, public TAttFill, public TAttMarke
Width_t fGridWidth; ///< Grid line width
Width_t fLegendBorderSize; ///< Legend box border size
Color_t fLegendFillColor; ///< Legend fill color
Style_t fLegendFillStyle; ///< Legend fill style
Style_t fLegendFont; ///< Legend font style
Double_t fLegendTextSize; ///< Legend text size. If 0 the size is computed automatically
Int_t fHatchesLineWidth; ///< Hatches line width for hatch styles > 3100
Expand Down Expand Up @@ -200,6 +201,7 @@ class TStyle : public TNamed, public TAttLine, public TAttFill, public TAttMarke
Double_t GetHatchesSpacing() const {return fHatchesSpacing;}
Width_t GetLegendBorderSize() const {return fLegendBorderSize;}
Color_t GetLegendFillColor() const {return fLegendFillColor;}
Style_t GetLegendFillStyle() const {return fLegendFillStyle;}
Style_t GetLegendFont() const {return fLegendFont;}
Double_t GetLegendTextSize() const {return fLegendTextSize;}
Int_t GetNumberOfColors() const;
Expand Down Expand Up @@ -347,6 +349,7 @@ class TStyle : public TNamed, public TAttLine, public TAttFill, public TAttMarke
void SetCanvasDefY(Int_t topy=10) {fCanvasDefY = topy;}
void SetLegendBorderSize(Width_t size=4) {fLegendBorderSize = size;}
void SetLegendFillColor(Color_t color=0) {fLegendFillColor = color;}
void SetLegendFillStyle(Style_t style=1001) {fLegendFillStyle = style;}
void SetLegendFont(Style_t font=62) {fLegendFont = font;}
void SetLegendTextSize(Double_t size=0.) {fLegendTextSize = size;}
void SetPadColor(Color_t color=19) {fPadColor = color;}
Expand Down Expand Up @@ -426,7 +429,7 @@ class TStyle : public TNamed, public TAttLine, public TAttFill, public TAttMarke
void SavePrimitive(std::ostream &out, Option_t * = "") override;
void SaveSource(const char *filename, Option_t *option = nullptr);

ClassDefOverride(TStyle, 22); //A collection of all graphics attributes
ClassDefOverride(TStyle, 23); //A collection of all graphics attributes
};


Expand Down
5 changes: 5 additions & 0 deletions core/base/src/TStyle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ TStyle::TStyle(const char *name, const char *title)
SetHistLineColor(kBlue+2);
SetLegendBorderSize(1);
SetLegendFillColor(0);
SetLegendFillStyle(1001);
SetLegendFont(42);
SetLegendTextSize(0.);
SetFuncWidth(2);
Expand Down Expand Up @@ -649,6 +650,7 @@ void TStyle::Copy(TObject &obj) const
((TStyle&)obj).fNumberContours = fNumberContours;
((TStyle&)obj).fLegendBorderSize = fLegendBorderSize;
((TStyle&)obj).fLegendFillColor = fLegendFillColor;
((TStyle&)obj).fLegendFillStyle = fLegendFillStyle;
((TStyle&)obj).fLegendFont = fLegendFont;
((TStyle&)obj).fLegendTextSize = fLegendTextSize;

Expand Down Expand Up @@ -795,6 +797,7 @@ void TStyle::Reset(Option_t *opt)
fLegendFont = 62;
fLegendTextSize = 0.,
fLegendFillColor = 0;
fLegendFillStyle = 1001;
fImageScaling = 1.;

SetDateX();
Expand Down Expand Up @@ -874,6 +877,7 @@ void TStyle::Reset(Option_t *opt)
SetHistLineColor(kBlue+2);
SetLegendBorderSize(1);
SetLegendFillColor(0);
SetLegendFillStyle(1001);
SetLegendFont(42);
SetLegendTextSize(0.);
SetFuncWidth(2);
Expand Down Expand Up @@ -2102,6 +2106,7 @@ void TStyle::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
out<<pre<<"tmpStyle->SetGridWidth(" <<GetGridWidth() <<");"<<std::endl;
out<<pre<<"tmpStyle->SetLegendBorderSize("<<GetLegendBorderSize()<<");"<<std::endl;
out<<pre<<"tmpStyle->SetLegendFillColor(" <<GetLegendFillColor() <<");"<<std::endl;
out<<pre<<"tmpStyle->SetLegendFillStyle(" <<GetLegendFillStyle() <<");"<<std::endl;
out<<pre<<"tmpStyle->SetLegendFont(" <<GetLegendFont() <<");"<<std::endl;
out<<pre<<"tmpStyle->SetLegendTextSize(" <<GetLegendTextSize() <<");"<<std::endl;
out<<pre<<"tmpStyle->SetHatchesLineWidth("<<GetHatchesLineWidth()<<");"<<std::endl;
Expand Down
3 changes: 3 additions & 0 deletions graf2d/graf/src/TLegend.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ TLegend::TLegend(): TPave(0.3,0.15,0.3,0.15,4,"brNDC"),
SetDefaults();
SetBorderSize(gStyle->GetLegendBorderSize());
SetFillColor(gStyle->GetLegendFillColor());
SetFillStyle(gStyle->GetLegendFillStyle());
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -237,6 +238,7 @@ TLegend::TLegend( Double_t x1, Double_t y1,Double_t x2, Double_t y2,
SetDefaults();
SetBorderSize(gStyle->GetLegendBorderSize());
SetFillColor(gStyle->GetLegendFillColor());
SetFillStyle(gStyle->GetLegendFillStyle());
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -270,6 +272,7 @@ TLegend::TLegend( Double_t w, Double_t h, const char *header, Option_t *option)
SetDefaults();
SetBorderSize(gStyle->GetLegendBorderSize());
SetFillColor(gStyle->GetLegendFillColor());
SetFillStyle(gStyle->GetLegendFillStyle());
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading