We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9532643 + f04b59e commit 47cd42bCopy full SHA for 47cd42b
observability-lib/grafana/panels.go
@@ -55,6 +55,8 @@ type LegendOptions struct {
55
Placement common.LegendPlacement
56
DisplayMode common.LegendDisplayMode
57
Calcs []string
58
+ SortBy string // Sort legend by this field (e.g., "Last *", "Max", "Mean")
59
+ SortDesc bool // Sort in descending order
60
}
61
62
func newLegend(options *LegendOptions) *common.VizLegendOptionsBuilder {
@@ -77,6 +79,13 @@ func newLegend(options *LegendOptions) *common.VizLegendOptionsBuilder {
77
79
78
80
builder.DisplayMode(options.DisplayMode)
81
82
+ if options.SortBy != "" {
83
+ builder.SortBy(options.SortBy)
84
+ if options.SortDesc {
85
+ builder.SortDesc(true)
86
+ }
87
88
+
89
return builder
90
91
0 commit comments