DIAG: improve readability

This commit is contained in:
hasufell 2014-12-03 21:20:46 +01:00
parent 9fca3ccaa9
commit f1f3f20a26
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 12 additions and 19 deletions

View File

@ -327,10 +327,8 @@ xAxis =
(replicate (floor . (/) (diagWidth p) $ squareSize p) (replicate (floor . (/) (diagWidth p) $ squareSize p)
(vrule 10)) (vrule 10))
# moveTo (p2 (diagXmin p, if diagYmin p <= 0 then 0 else diagYmin p)) # moveTo (p2 (diagXmin p, if diagYmin p <= 0 then 0 else diagYmin p))
labels p _ = labels p _ = position . zip (mkPoint <$> xs)
position $ $ ((\x -> (text . show $ x) # scale 10) <$> xs)
zip (mkPoint <$> xs)
((\x -> (text . show $ x) # scale 10) <$> xs)
where where
xs :: [Int] xs :: [Int]
xs = take (floor . (/) (diagWidth p) $ squareSize p) xs = take (floor . (/) (diagWidth p) $ squareSize p)
@ -347,19 +345,15 @@ yAxis =
<> Diag segments <> Diag segments
<> Diag labels <> Diag labels
where where
vRule p _ = vRule p _ = arrowAt (p2 (if diagXmin p <= 0 then 0 else diagXmin p, diagYmin p))
arrowAt (p2 (if diagXmin p <= 0 then 0 else diagXmin p, diagYmin p)) (r2 (0, diagHeight p))
(r2 (0, diagHeight p)) segments p _ = vcat' (with & sep .~ squareSize p)
segments p _ = (replicate (floor . (/) (diagHeight p) $ squareSize p)
vcat' (with & sep .~ squareSize p) (hrule 10))
(replicate (floor . (/) (diagHeight p) $ squareSize p)
(hrule 10))
# alignB # alignB
# moveTo (p2 (if diagXmin p <= 0 then 0 else diagXmin p, diagYmin p)) # moveTo (p2 (if diagXmin p <= 0 then 0 else diagXmin p, diagYmin p))
labels p _ = labels p _ = position . zip (mkPoint <$> ys)
position $ $ ((\x -> (text . show $ x) # scale 10) <$> ys)
zip (mkPoint <$> ys)
((\x -> (text . show $ x) # scale 10) <$> ys)
where where
ys :: [Int] ys :: [Int]
ys = take (floor . (/) (diagHeight p) $ squareSize p) ys = take (floor . (/) (diagHeight p) $ squareSize p)
@ -373,10 +367,9 @@ yAxis =
whiteRectB :: Diag whiteRectB :: Diag
whiteRectB = Diag rect' whiteRectB = Diag rect'
where where
rect' p _ = rect' p _ = whiteRect (diagWidth p + (diagWidth p / 10))
whiteRect (diagWidth p + (diagWidth p / 10)) (diagHeight p + (diagHeight p / 10))
(diagHeight p + (diagHeight p / 10)) # moveTo (p2 (diagWidthOffset p, diagHeightOffset p))
# moveTo (p2 (diagWidthOffset p, diagHeightOffset p))
where where