Currently browsing

December 2014

Responsive SVG

Imagine that you’ve used your incredible creativity to create the following beautiful HTML: You open the page in a browser and all looks fine – well, sort of. The top, left and bottom edge of the div’s border touch the circle (at least more or less), but the right edge …

Pie in the Sky, with D3

The world is divided in beer drinkers and wine lovers. Let’s illustrate this with a pie chart, using D3 for all the rendering work. First, we need some data: The pie data for plotting can be created with D3’s pie layout. By default, the slices will start from the 12 …

Logging in Grunt, in colour

Grunt provides various functions for logging, such as grunt.log.error() and grunt.log.ok(). Most of these prepend the message with ‘>>’ and don’t colour the message itself. If you just want to output a coloured string, use grunt.log.write() or grunt.log.writeln() together with the colours provided by the colors library. Here is an …