1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
# barchart/horizontal-show-value

```go
package main
import "github.com/pterm/pterm"
func main() {
// Define the data for the bar chart
barData := []pterm.Bar{
{Label: "A", Value: 10},
{Label: "B", Value: 20},
{Label: "C", Value: 30},
{Label: "D", Value: 40},
{Label: "E", Value: 50},
{Label: "F", Value: 40},
{Label: "G", Value: 30},
{Label: "H", Value: 20},
{Label: "I", Value: 10},
}
// Create a bar chart with the defined data
// The chart is horizontal and displays the value of each bar
// The Render() function is called to display the chart
pterm.DefaultBarChart.WithBars(barData).WithHorizontal().WithShowValue().Render()
}
```
|