Comment on page
BarChart
The bar chart printer can be used to show data in relation to each other
positiveBars := pterm.Bars{
pterm.Bar{
Label: "Bar 1",
Value: 5,
},
pterm.Bar{
Label: "Bar 2",
Value: 3,
},
pterm.Bar{
Label: "Longer Label",
Value: 7,
},
}
pterm.Info.Println("Chart example with positive only values (bars use 100% of chart area)")
pterm.DefaultBarChart.WithBars(positiveBars).Render()
pterm.DefaultBarChart.WithHorizontal().WithBars(positiveBars).Render()
Name | Type | Description |
---|---|---|
Root | TreeNode | The structured tree |
TreeStyle | *Style | Style of the tree |
TextStyle | *Style | Style of the text |
TopRightCornerString | string | Top right corner string |
TopRightDownString | string | Top right down string |
HorizontalString | string | Horizontal string |
VerticalString | string | Vertical string |
RightDownLeftString | string | Right down left string |
Indent | int | Space between levels |
Writer | io.Writer | Sets a custom writer |
This printer implements the
RenderablePrinter
interface.Method | Description |
---|---|
Render() | Prints to the terminal or uses the specified Writer |
Srender() | Returns the rendered string |
pkg.go.dev contains the full specification for this printer and more technical descriptions.
Last modified 1yr ago