Skip to content

Commit

Permalink
fix ylim
Browse files Browse the repository at this point in the history
  • Loading branch information
Mast3rwaf1z committed Nov 15, 2024
1 parent c387fb3 commit 4e59297
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/Pages/Admin/Admin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,21 @@ maxValue :: [Int] -> Int
maxValue (x:y:xs) | x >= y = maxValue (x:xs)
| otherwise = maxValue (y:xs)
maxValue [x] = x
maxValue [] = 0
maxValue [] = 10

minValue :: [Int] -> Int
minValue (x:y:xs) | x <= y = minValue (x:xs)
| otherwise = minValue (y:xs)
minValue [x] = x
minValue [] = 0

metrics :: IO Html
metrics = do
visitsPlot <- do
(unique, aggregated) <- aggregatedVisits
svg <- toSvg $
bar [show x | x <- unique] aggregated %
ylim (head aggregated - 1) (maxValue aggregated) %
ylim (minValue aggregated) (maxValue aggregated) %
title "Visits" %
common
return $ case svg of
Expand All @@ -106,7 +112,7 @@ metrics = do
(unique, aggregated) <- aggregatedGuestbook
svg <- toSvg $
bar [show x | x <- unique] aggregated %
ylim (head aggregated - 1) (maxValue aggregated) %
ylim (minValue aggregated) (maxValue aggregated) %
title "Guestbook" %
common
return $ case svg of
Expand All @@ -117,7 +123,7 @@ metrics = do
(unique, aggregated) <- aggregatedLeaderboard
svg <- toSvg $
bar [show x | x <- unique] aggregated %
ylim (head aggregated - 1) (maxValue aggregated) %
ylim (minValue aggregated) (maxValue aggregated) %
title "Snake Leaderboard" %
common
return $ case svg of
Expand Down

0 comments on commit 4e59297

Please sign in to comment.