-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverted barchart/main.go to original state.
- Loading branch information
Showing
4 changed files
with
96 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/pterm/pterm" | ||
) | ||
|
||
func main() { | ||
positiveBars := pterm.Bars{ | ||
pterm.Bar{ | ||
Label: "Bar 1", | ||
Value: 5, | ||
}, | ||
pterm.Bar{ | ||
Label: "Bar 2", | ||
Value: 3, | ||
}, | ||
pterm.Bar{ | ||
Label: "Longer Label", | ||
Value: 7, | ||
}, | ||
} | ||
|
||
fmt.Println("Chart example with positive only values (bars use 100% of chart area)") | ||
_ = pterm.DefaultBarChart.WithBars(positiveBars).Render() | ||
_ = pterm.DefaultBarChart.WithHorizontal().WithBars(positiveBars).Render() | ||
fmt.Println("=====================================================================") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/pterm/pterm" | ||
) | ||
|
||
func main() { | ||
negativeBars := pterm.Bars{ | ||
pterm.Bar{ | ||
Label: "Bar 1", | ||
Value: -5, | ||
}, | ||
pterm.Bar{ | ||
Label: "Bar 2", | ||
Value: -3, | ||
}, | ||
pterm.Bar{ | ||
Label: "Longer Label", | ||
Value: -7, | ||
}, | ||
} | ||
|
||
fmt.Println("Chart example with negative only values (bars use 100% of chart area)") | ||
_ = pterm.DefaultBarChart.WithBars(negativeBars).Render() | ||
_ = pterm.DefaultBarChart.WithHorizontal().WithBars(negativeBars).Render() | ||
fmt.Println("=====================================================================") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/pterm/pterm" | ||
) | ||
|
||
func main() { | ||
mixedBars := pterm.Bars{ | ||
pterm.Bar{ | ||
Label: "Bar 1", | ||
Value: 2, | ||
}, | ||
pterm.Bar{ | ||
Label: "Bar 2", | ||
Value: -3, | ||
}, | ||
pterm.Bar{ | ||
Label: "Bar 3", | ||
Value: -2, | ||
}, | ||
pterm.Bar{ | ||
Label: "Bar 4", | ||
Value: 5, | ||
}, | ||
pterm.Bar{ | ||
Label: "Longer Label", | ||
Value: 7, | ||
}, | ||
} | ||
|
||
fmt.Println("Chart example with mixed values (note screen space usage in case when ABSOLUTE values of negative and positive parts are differ too much)") | ||
_ = pterm.DefaultBarChart.WithBars(mixedBars).Render() | ||
_ = pterm.DefaultBarChart.WithHorizontal().WithBars(mixedBars).Render() | ||
fmt.Println("=====================================================================") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters