fix: fix the color of series label, #37

This commit is contained in:
vicanso 2022-12-07 19:57:35 +08:00
parent df6180e59a
commit f9a534ea02
2 changed files with 20 additions and 15 deletions

View file

@ -168,14 +168,16 @@ func (b *barChart) render(result *defaultRenderResult, seriesList SeriesList) (B
}
y := barMaxHeight - h
radians := float64(0)
var fontColor Color
fontColor := series.Label.Color
if series.Label.Position == PositionBottom {
y = barMaxHeight
radians = -math.Pi / 2
if isLightColor(fillColor) {
fontColor = defaultLightFontColor
} else {
fontColor = defaultDarkFontColor
if fontColor.IsZero() {
if isLightColor(fillColor) {
fontColor = defaultLightFontColor
} else {
fontColor = defaultDarkFontColor
}
}
}
labelPainter.Add(LabelValue{