From 481fc54cd460491ea0bd8a7c0947b6133fef4576 Mon Sep 17 00:00:00 2001 From: FabioRNobrega Date: Tue, 10 Mar 2026 12:23:03 -0300 Subject: [PATCH] docs: add pie radius pad angle example --- examples/pie.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/examples/pie.go b/examples/pie.go index 1c18615..d882c5b 100644 --- a/examples/pie.go +++ b/examples/pie.go @@ -68,6 +68,36 @@ func pieRadius() *charts.Pie { return pie } +func pieRadiusWithPadAngle() *charts.Pie { + pie := charts.NewPie() + pie.SetGlobalOptions( + charts.WithTitleOpts(opts.Title{Title: "Radius style with padAngle"}), + charts.WithTooltipOpts(opts.Tooltip{ + Show: opts.Bool(true), + Formatter: "{b}: {d}%", + }), + charts.WithLegendOpts(opts.Legend{ + Orient: "vertical", + Right: "20%", + Top: "center", + Padding: []any{1, 1, 1, 1}, + }), + ) + + pie.AddSeries("pie", generatePieItems()). + SetSeriesOptions( + charts.WithLabelOpts(opts.Label{ + Show: opts.Bool(false), + }), + charts.WithPieChartOpts(opts.PieChart{ + Radius: []string{"40%", "75%"}, + Center: []string{"40%", "50%"}, + PadAngle: 5, + }), + ) + return pie +} + func pieRoseArea() *charts.Pie { pie := charts.NewPie() pie.SetGlobalOptions( @@ -242,10 +272,12 @@ type PieExamples struct{} func (PieExamples) Examples() { page := components.NewPage() + page.AssetsHost = "https://cdn.jsdelivr.net/npm/echarts@5.6.0/dist/" page.AddCharts( pieBase(), pieShowLabel(), pieRadius(), + pieRadiusWithPadAngle(), pieRoseArea(), pieRoseRadius(), pieRoseAreaRadius(),