Beautiful timetables
November 11, 2007Because I wanted a clear and compact way to display the timetable of the tram nearby, I created a small project. My goal was to have something more ‘visual’ than a list with numbers. I am interested in new ways to display information and what’s nice about it and why.
I think the result is something that has a bit of a learning curve and is therefore less suitable for ‘one-time’ usage. On the other hand, because it’s more of a picture and not a bunch of numbers I think it’s much easier to learn the timetable by heart for regular users.
For specification I wanted a small and simple language and preferably not start with writing a parser, so I decided to hitch a ride with Haskell first.
I’d love to hear your opinion, both a first reaction and after experimenting with it.
ยป Download it
Nice. One little coding hint:
mapM_ f xs = sequence_ $ map f xs
there’s also the forM_ variant with arguments reversed.
You might also look at the Text.Pretty library for an IO-free way of doing the rendering of documents from Haskell values. An example is the generator for the haskell weekly news, http://www.cse.unsw.edu.au/~dons/code/hwn/utils/publish.hs
by dons November 11, 2007 at 3:22 amThat looks cool, and the code is still pretty small. Nice work!
by chriseidhof November 11, 2007 at 10:43 amThat’s lovely! Maybe you can increase readability by coloring the dots and adding a light-gray finer-grained horizontal grid.
Maybe I’ll take a shot at it, but I’m not familiar with Tikz at all. Yet.
by Ben November 12, 2007 at 12:09 am@dons: thanks, I guess the code can use some refactoring ๐
The code doesn’t do much, actually. I forgot to tell something about the ‘features’ in the post but some thing it does:
* Minimize the width of timetable by splitting at the biggest ‘gap’ (and not at midnight).
* Calculate all sets of days, sorting them on the number of days.
* The colors of the sets go from dark to light. So, the darker the dot, the more days it accounts for.
@Ben: the reason the dots are gray is mainly that it should be printable on my laser printer ๐
by eelco November 12, 2007 at 2:57 pmHee tof, maar hoe kan ik hiermee aan de slag?
by Pim November 14, 2007 at 6:02 pmgroet van een trambaangenoot.
Hee Pim, het is op dit moment nog allemaal een beetje sterk gekoppeld met Haskell. Je hebt dus een Haskell compiler (zoals http://haskell.org/ghc/) nodig. In de zip zit een README.lhs met een klein voorbeeldje en verdere uitleg, had je die al gezien?
by eelco November 14, 2007 at 9:01 pm