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 4f678cd commit c387fb3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/Pages/Admin/Admin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ common = setParameter "savefig.transparent" True %
xlabel "daysSinceEpoch" %
ylabel "amount"

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

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

0 comments on commit c387fb3

Please sign in to comment.