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

@ -27,10 +27,9 @@ import (
)
func barChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error) {
d := result.d
bd, err := NewDraw(DrawOption{
Parent: d,
d, err := NewDraw(DrawOption{
Parent: result.d,
}, PaddingOption(chart.Box{
Top: result.titleBox.Height(),
Left: YAxisWidth,
@ -65,7 +64,7 @@ func barChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error) {
h := int(yRange.getHeight(item.Value))
bd.Bar(chart.Box{
d.Bar(chart.Box{
Top: barMaxHeight - h,
Left: x,
Right: x + barWidth,
@ -76,5 +75,5 @@ func barChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error) {
}
}
return d, nil
return result.d, nil
}