Bar Panel Builder#
Constructor#
Need a list of options.
Default options#
- Calculation(): last
Available options#
Calculation#
import "github.com/perses/perses/go-sdk/common"
import "github.com/perses/perses/go-sdk/panel/bar"
bar.Calculation(common.Last)
Define the chart calculation.
Format#
import "github.com/perses/perses/go-sdk/common"
import "github.com/perses/perses/go-sdk/panel/bar"
bar.Format(common.Format{...})
Define the chart format.
SortingBy#
Define the chart sorting.
WithMode#
Define the chart mode.
Example#
package main
import (
"github.com/perses/perses/go-sdk/common"
"github.com/perses/perses/go-sdk/dashboard"
panelgroup "github.com/perses/perses/go-sdk/panel-group"
"github.com/perses/perses/go-sdk/panel/bar"
)
func main() {
dashboard.New("Example Dashboard",
dashboard.AddPanelGroup("Resource usage",
panelgroup.AddPanel("Container memory",
bar.Chart(
bar.Calculation(common.LastCalculation),
bar.Format(common.Format{
Unit: common.BytesUnit,
}),
bar.SortingBy(bar.AscSort),
bar.WithMode(bar.PercentageMode),
),
),
),
)
}