DIAGRAM: trim text coordinates to 2 decimal places

This commit is contained in:
hasufell 2014-10-26 00:19:58 +02:00
parent 55e2ddd500
commit 90eaa45289
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 2 additions and 1 deletions

View File

@ -31,8 +31,9 @@ coordPoints = Diag cp
-- in text format, such as "(1.0, 2.0)".
pointToTextCoord :: PT -> Diagram Cairo R2
pointToTextCoord pt =
text ("(" ++ show x ++ ", " ++ show y ++ ")") # scale 10
text ("(" ++ (show . trim') x ++ ", " ++ (show . trim') y ++ ")") # scale 10
where
trim' x' = (fromInteger . round $ x' * (10^2)) / (10.0^^2)
(x, y) = unp2 pt