Prettier X Scale
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package gopow
|
package gopow
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"math"
|
"math"
|
||||||
"time"
|
"time"
|
||||||
@@ -86,7 +87,7 @@ func (a *Annotator) DrawXScale() error {
|
|||||||
}).Debug("annotate X scale")
|
}).Debug("annotate X scale")
|
||||||
|
|
||||||
// how many samples?
|
// how many samples?
|
||||||
count := int(math.Floor(float64(a.table.Bins) / float64(500)))
|
count := int(math.Floor(float64(a.table.Bins) / float64(350)))
|
||||||
|
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"labels": count,
|
"labels": count,
|
||||||
@@ -100,7 +101,8 @@ func (a *Annotator) DrawXScale() error {
|
|||||||
hz := a.table.HzLow + (float64(si) * hzPerLabel)
|
hz := a.table.HzLow + (float64(si) * hzPerLabel)
|
||||||
px := si * pxPerLabel
|
px := si * pxPerLabel
|
||||||
|
|
||||||
str := humanize.SI(hz, "Hz")
|
fract, suffix := humanize.ComputeSI(hz)
|
||||||
|
str := fmt.Sprintf("%0.2f %sHz", fract, suffix)
|
||||||
|
|
||||||
// draw a guideline on the exact frequency
|
// draw a guideline on the exact frequency
|
||||||
for i := 0; i < 50; i++ {
|
for i := 0; i < 50; i++ {
|
||||||
|
|||||||
Reference in New Issue
Block a user