@@ -15,7 +15,8 @@ Need a list of options.
1515
1616## Default options
1717
18- - None
18+ - Calculation: ` last `
19+ - Visual outer radius: ` "90%" `
1920
2021## Available options
2122
@@ -43,13 +44,29 @@ package main
4344import pie " github.com/perses/plugins/piechart/sdk/go"
4445
4546pie.WithVisual (pie.Visual {
46- Palette : pie.Palette {
47- Mode: pie.AutoMode , // or pie.CategoricalMode
48- },
47+ OuterRadius : " 90% " ,
4948})
5049```
5150
52- Define visual properties of the pie chart including color palette mode.
51+ Define the pie chart's radii and colors. Radius values can be percentages or unitless pixel strings.
52+
53+ ``` golang
54+ pie.WithVisual (pie.Visual {
55+ InnerRadius : " 40% " ,
56+ OuterRadius : " 90% " ,
57+ ColorPalette : []string {" #3366cc" , " #dc3912" },
58+ })
59+ ```
60+
61+ Set ` InnerRadius ` to create a doughnut chart. When omitted, the chart renders as a pie.
62+
63+ ### WithShowLabels
64+
65+ ``` golang
66+ pie.WithShowLabels (true )
67+ ```
68+
69+ Show labels inside the pie chart segments.
5370
5471### WithFormat
5572
@@ -69,33 +86,15 @@ pie.WithFormat(&common.Format{
6986
7087Define the format for pie chart values.
7188
72- ### WithQuerySettings
73-
74- ``` golang
75- package main
76-
77- import pie " github.com/perses/plugins/piechart/sdk/go"
78-
79- pie.WithQuerySettings ([]pie.QuerySettingsItem {
80- {
81- QueryIndex: 0 ,
82- ColorMode: pie.FixedMode ,
83- ColorValue: " #FF5733" ,
84- },
85- })
86- ```
87-
88- Define color settings for specific queries. Available color modes: ` FixedMode ` , ` FixedSingleMode ` .
89-
9089## Example
9190
9291``` golang
9392package main
9493
9594import (
95+ " github.com/perses/perses/go-sdk/common"
9696 " github.com/perses/perses/go-sdk/dashboard"
9797 " github.com/perses/perses/go-sdk/panel"
98- " github.com/perses/perses/go-sdk/common"
9998 pie " github.com/perses/plugins/piechart/sdk/go"
10099)
101100
@@ -110,7 +109,8 @@ func main() {
110109 Size: pie.MediumSize ,
111110 }),
112111 pie.WithVisual (pie.Visual {
113- Palette: pie.Palette {Mode: pie.CategoricalMode },
112+ InnerRadius: " 40% " ,
113+ OuterRadius: " 90% " ,
114114 }),
115115 pie.WithFormat (&common.Format {
116116 Unit: &common.BytesUnit ,
@@ -120,5 +120,5 @@ func main() {
120120 ),
121121 ),
122122 )
123- }` ` `
123+ }
124124```
0 commit comments