inline/remove top level oneliners
This commit is contained in:
parent
ec21f4c6e8
commit
9484597491
@ -1,17 +1,15 @@
|
|||||||
-- miscellaneous functions extracted from Main so
|
-- miscellaneous functions extracted from Main so
|
||||||
-- we can more easily test them
|
-- we can more easily test them
|
||||||
|
|
||||||
module Lib exposing(looseLabels)
|
module Lib exposing (looseLabels)
|
||||||
|
|
||||||
|
|
||||||
-- https://github.com/cenfun/nice-ticks/blob/master/docs/Nice-Numbers-for-Graph-Labels.pdf
|
-- https://github.com/cenfun/nice-ticks/blob/master/docs/Nice-Numbers-for-Graph-Labels.pdf
|
||||||
|
|
||||||
log10 x = logBase 10 x
|
|
||||||
expt b x = b^(toFloat x)
|
|
||||||
|
|
||||||
niceNumber x round =
|
niceNumber x round =
|
||||||
let exp = floor (log10 x)
|
let expt b ex = b^ toFloat ex
|
||||||
f = x / (expt 10.0 exp)
|
exp = floor (logBase 10 x)
|
||||||
|
f = x / expt 10.0 exp
|
||||||
nfRound = if f < 1.5
|
nfRound = if f < 1.5
|
||||||
then 1
|
then 1
|
||||||
else if f < 3
|
else if f < 3
|
||||||
@ -37,6 +35,6 @@ looseLabels ticks min max =
|
|||||||
let
|
let
|
||||||
range = niceNumber (max-min) False
|
range = niceNumber (max-min) False
|
||||||
d = niceNumber (range/(ticks - 1)) True
|
d = niceNumber (range/(ticks - 1)) True
|
||||||
graphmin = toFloat (floor (min/d)) * d
|
graphmin = toFloat (floor (min/d)) * d
|
||||||
graphmax = toFloat (ceiling (max/d)) * d
|
graphmax = toFloat (ceiling (max/d)) * d
|
||||||
in (graphmin, graphmax, d)
|
in (graphmin, graphmax, d)
|
||||||
|
Loading…
Reference in New Issue
Block a user