Browse Source

add vertical lines

Getty Ritter 10 months ago
parent
commit
291562f79c
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/Rolling/Render.hs

+ 9 - 1
src/Rolling/Render.hs

@@ -50,7 +50,7 @@ text t = do
 diagram :: Diagram -> IO ()
 diagram d = do
   let results = rolls d
-      width = 400
+      width = 380
       height = length results * 50 + 50
   surface <- Cairo.createImageSurface Cairo.FormatRGB24 width height
   Cairo.renderWith surface $ do
@@ -61,8 +61,16 @@ diagram d = do
     Monad.forM_ results $ \(n, r) ->
       renderRow r n
 
+    Monad.forM_ [0.0, 0.25, 0.5, 0.75, 1.0] $ \rat -> do
+      let x = 5 + 290 * rat
+      Cairo.setSourceRGB 0.0 0.0 0.0
+      Cairo.moveTo x 5
+      Cairo.lineTo x (fromIntegral (length results) * 50 - 5)
+      Cairo.stroke
+
     Cairo.setSourceRGB 0.0 0.0 0.0
     layout <- text (title d)
     Cairo.moveTo 20 (fromIntegral height - 50)
     Pango.showLayout layout
+
   Cairo.surfaceWriteToPNG surface (filename d)