feat: pie chart render function

This commit is contained in:
vicanso 2022-02-03 21:00:01 +08:00
parent 445a781b04
commit eb45c6479e
7 changed files with 164 additions and 24 deletions

View file

@ -29,11 +29,10 @@ import (
func lineChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error) {
d := result.d
theme := NewTheme(opt.Theme)
sd, err := NewDraw(DrawOption{
Parent: d,
d, err := NewDraw(DrawOption{
Parent: result.d,
}, PaddingOption(chart.Box{
Top: result.titleBox.Height(),
Left: YAxisWidth,
@ -60,7 +59,7 @@ func lineChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error)
if theme.IsDark() {
dotFillColor = seriesColor
}
sd.Line(points, LineStyle{
d.Line(points, LineStyle{
StrokeColor: seriesColor,
StrokeWidth: 2,
DotColor: seriesColor,
@ -70,5 +69,5 @@ func lineChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error)
}
}
return d, nil
return result.d, nil
}