This commit is contained in:
Will Charczuk 2016-07-29 18:40:43 -07:00
parent cbc0002d2a
commit a008ebe30e
5 changed files with 27 additions and 10 deletions

View file

@ -242,15 +242,29 @@ func (pc PieChart) styleDefaultsElements() Style {
func (pc PieChart) styleDefaultsTitle() Style {
return pc.TitleStyle.InheritFrom(Style{
FontColor: DefaultTextColor,
FontColor: ColorWhite,
Font: pc.GetFont(),
FontSize: 24.0,
FontSize: pc.getTitleFontSize(),
TextHorizontalAlign: TextHorizontalAlignCenter,
TextVerticalAlign: TextVerticalAlignTop,
TextWrap: TextWrapNone,
TextWrap: TextWrapWord,
})
}
func (pc PieChart) getTitleFontSize() float64 {
effectiveDimension := Math.MinInt(pc.GetWidth(), pc.GetHeight())
if effectiveDimension >= 2048 {
return 48
} else if effectiveDimension >= 1024 {
return 24
} else if effectiveDimension >= 512 {
return 18
} else if effectiveDimension >= 256 {
return 12
}
return 10
}
// Box returns the chart bounds as a box.
func (pc PieChart) Box() Box {
dpr := pc.Background.Padding.GetRight(DefaultBackgroundPadding.Right)