diff --git a/bar_chart.go b/bar_chart.go index d8a307e..efeb465 100644 --- a/bar_chart.go +++ b/bar_chart.go @@ -189,6 +189,7 @@ func (b *barChart) render(result *defaultRenderResult, seriesList SeriesList) (B Radians: radians, FontColor: fontColor, Offset: series.Label.Offset, + FontSize: series.Label.FontSize, }) } diff --git a/horizontal_bar_chart.go b/horizontal_bar_chart.go index 95d9a3d..2ab4c03 100644 --- a/horizontal_bar_chart.go +++ b/horizontal_bar_chart.go @@ -156,6 +156,7 @@ func (h *horizontalBarChart) render(result *defaultRenderResult, seriesList Seri Y: y + barHeight>>1, Offset: series.Label.Offset, FontColor: series.Label.Color, + FontSize: series.Label.FontSize, } if series.Label.Position == PositionLeft { labelValue.X = 0 diff --git a/line_chart.go b/line_chart.go index 26f94a4..9f350bd 100644 --- a/line_chart.go +++ b/line_chart.go @@ -147,6 +147,8 @@ func (l *lineChart) render(result *defaultRenderResult, seriesList SeriesList) ( Value: item.Value, X: p.X, Y: p.Y, + // 字体大小 + FontSize: series.Label.FontSize, }) } // 如果需要填充区域 diff --git a/series.go b/series.go index c36fa8b..13c637e 100644 --- a/series.go +++ b/series.go @@ -83,6 +83,8 @@ type SeriesLabel struct { Position string // The offset of label's position Offset Box + // The font size of label + FontSize float64 } const ( diff --git a/series_label.go b/series_label.go index f0fb2ec..10fd148 100644 --- a/series_label.go +++ b/series_label.go @@ -45,8 +45,10 @@ type LabelValue struct { Radians float64 // 字体颜色 FontColor Color - Orient string - Offset Box + // 字体大小 + FontSize float64 + Orient string + Offset Box } type SeriesLabelPainter struct { @@ -89,6 +91,9 @@ func (o *SeriesLabelPainter) Add(value LabelValue) { FontSize: labelFontSize, Font: o.font, } + if value.FontSize != 0 { + labelStyle.FontSize = value.FontSize + } if !value.FontColor.IsZero() { label.Color = value.FontColor }