- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 107
 
Open
Description
If I have data points that are the same value, e.g. with:
func Test_AsciiGraph(t *testing.T) {
	coverageGraphPoints := []float64{49.51, 49.51, 49.51}
	asciiGraph := fmt.Sprintf("\n\n%s", asciigraph.Plot(coverageGraphPoints,
		asciigraph.Precision(2),
		asciigraph.Caption("Code Coverage (excluding generated)")))
	fmt.Println(asciiGraph)
}Then I get a rounded y axis value of 50.00, rather than 49.51:
=== RUN   Test_AsciiGraph
 50.00 ┼──
        Code Coverage (excluding generated)
--- PASS: Test_AsciiGraph (0.00s)
PASS
But if I have one value different, I get the graph that I expect (with coverageGraphPoints := []float64{49.51, 49.51, 49.52}:
=== RUN   Test_AsciiGraph
 49.52 ┤ ╭
 49.52 ┤ │
 49.51 ┼─╯
        Code Coverage (excluding generated)
--- PASS: Test_AsciiGraph (0.00s)
PASS
I do not want this rounding, and I instead want something like this:
=== RUN   Test_AsciiGraph
 49.51 ┼──
        Code Coverage (excluding generated)
--- PASS: Test_AsciiGraph (0.00s)
PASS
Was this a design decision to round when the values are the same? I see we are using a rounded "max2" at pkg/mod/github.com/guptarohit/[email protected]/asciigraph.go:82
Metadata
Metadata
Assignees
Labels
No labels