The Singapore government just announced the 2018 budget on February 19th 2018.

As usual, we’ll take a look at the data from a macro lens across many years to see if there might be interesting trends we can glean from the 2018 budget visualization.

This is the fifth year running that I’ve been doing this. Many of the visualizations were pre-written, so I just added the latest data figures from MOF.

Here’s the work done in previous years, if you’re interested to compare:

The whole point of this series is to give readers a sense of the long-term trends in the budgets.

For chart embeds, simply cut and paste the following code snippets into your blog or website:
Note: You can change the height of the iFrame below to fit whatever screen height you prefer.

It would be nice if you choose to use these embeds to have a shoutout to V/R!

Revenue vs Expenditure Chart:


<iframe src="http://viz.sg/viz/budget2018/budget2018_revenue_vs_expenditure.html" style="border:0; overflow:hidden; width:100%; height:600px;"></iframe>

Expenditure Chart:


<iframe src="http://viz.sg/viz/budget2018/budget2018_expenditure.html" style="border:0; overflow:hidden; width:100%; height:600px;"></iframe>

Revenue Chart:


<iframe src="http://viz.sg/viz/budget2018/budget2018_revenue.html" style="border:0; overflow:hidden; width:100%; height:600px;"></iframe>

And here is the new chart for this year!

Expenditure by sector:


<iframe src="http://viz.sg/viz/budget2018/budget2018_sector.html" style="border:0; overflow:hidden; width:100%; height:600px;"></iframe>

This zoomable packed circle visualization I designed and wrote for a client of mine was an interesting piece to show part-in-part comparisons without cluttering up the visual space.

The ask was to write a visualization piece that could dynamically load and layout a complicated JSON tree in an aesthetically pleasing way, and yet look visually appealing.

In this case the visualization is adapted for my own Budget 2018 visualization project with a few tweaks.

Hierarchy trees can be displayed as trees (as a graph), as a treemap, sunbursts, or as packed bubble charts.

Personally I prefer packed bubble charts to treemaps. I think that circles are more aesthetically pleasing to the eye than rectangles, but this is me.

The key idea, though, was not to a show the whole hierarchy, but to have some kind of zoom-in and zoom-out transition at the node level so as not to clutter the entire visual field for complicated trees.

You may lose seeing the whole overall picture of the entire tree hierarchy, but for that you get to concentrate on a slice of the tree.

Was pretty happy with the zoom-in and zoom-out transitions as I hope it is intuitive to users.

One other interesting code portion was how to pack and scale words into the bubble so that it aesthetically fit within the bubble. After lots of experimentation to find a nice scaling algorithm, found something that works reasonably well.

Also had to tweak small portions of the code such that mouseover gives more information and context for desktop users, but this functionality does not clash for mobiles and tablets.

All in all, this was the final result, which I am quite happy about. 😀

All of the following code was written in D3.

This is behind the scenes work that we do for clients – designing UX interactions, animations / transitions, dashboard designs and form factor layout solutions.

Firstbridge Montesorri

By Chi-Loong Chan | | Animation

We did this website project for Firstbridge Montesorri in 2017.

Unlike standard websites, the ask was to create a unique piece of artwork animation wise. This is a scroll-based animation website (pretty much like the main V/R website), where the animation is hooked to the scroll.

The animation tried in this piece is slightly different, where a lot of animations are line-based strokes. Combined with the color fills, it gives an idea of a children’s art piece, where the lines are drawn and coloured in.

The clouds are procedurally generated on the main page with random positioning, to give the effect that when you scroll downwards you’re actually moving through layers of clouds.

One thing to mention is that we took out all the parallax animations for mobile and tablet. The piece is heavy enough that it will work on the latest modern phones, but we wanted to give slightly less powerful mobile devices a fighting chance to run the site! 😀

Artwork is all custom (including all posters and logos) from our design end, and of course so is the animation design of this piece.

Small pieces of code to hook to the eBook platform that firstBridge publishes to, plus linking to all the latest photos on Facebook for the different schools on the site.

All in all, I loved doing something so pretty for the client.

moire2
In mathematics, physics, and art, moiré patterns are large scale interference patterns that can be produced when an opaque pattern with transparent gaps is overlaid on another similar pattern.
Besides being areas of study in mathematics and physics (e.g. in image processing and computer vision) they have real world applications like bank note forgery detection.

But as art itself, moiré patterns can be beautiful and hypnotic.

They are particularly suitable for visualization as procedurally generated art, and can create some really interesting optical illusions.
I was inspired by the below excellent Numberphile video on how random dots arranged on a page can create stunning optical dot illusions, and I wanted to duplicate the effect on an interactive medium.

So I coded up this interactive piece: A Study in Moire Patterns

Using D3 + Greensock

D3 (Data-Driven Documents) is an extremely popular javascript library often known for its use in creating data visualizations. However, it can also be used to create all kinds of fun code art experiments that have little to do with data visualization.

If you want to create SVG on the fly, I would well recommend D3. It is well supported, has excellent traction and there are lots of resources to find information. D3 is really excellent when it comes to binding data to the views.

For animation, my go-to library is Greensock. Sure, there are tons of other animation libraries out there. You can even do some nice transition work in D3. If it is simple, you can even just use CSS.

However I really like Greensock as it is pretty robust, and more importantly it provides a useful mental framework for animation using timelines and tweens.

The rest of the project used Bootstrap for easy responsive layout, and JQuery and JQuery UI was added to hook the interface together. One of the best things about vector-based graphics like SVG is that they are size invariant, and can look equally sharp on desktop to mobile.

There are tons of good reasons why animated SVG are a great way to build animations.

Code time

I’ve put up a few examples used for this project on bl.ocks.org, a viewer for mainly D3 code on Github’s Gist. (This, like D3, is created by Mike Bostock).

In them, you will see that the actual code is not that complicated. Draw the SVG using D3, then animate it using Greensock.

Final thoughts

The reason why we are able to build beautiful code so easily now is because of the amazing amount of high quality libraries, platforms and packages being released by the tech community as a whole.

So as coders we owe a huge debt to all the free tools and libraries we use to build our stuff.

At the same time it can easily feel overwhelming, and you constantly wonder why there are always so many things to learn. Here’s a humorous take on take on that. If you work in the frontend space, you’ll grok it immediately. 😀

Perhaps the answer is that there is no need to be an expert in everything because the simple answer is that you can’t be.

Just focus on an area that you like and work on that. Eventually like any craft if you do enough work in an area, you will acquire some experience and be better at it.

Once in a while, go learn something new because you are intrigued by something, not because it is the “next best thing” you need to learn.

And that is the way to keep the passion for your craft alive. 😀

Animation Foundry

By Chi-Loong Chan | | Animation, V/R, Visualization

animation_foundry

Add bling to your websites. No cod or infrastructure on your end needed!

Animation Foundry was an idea both Kok Keong and I had been toying around for some time.

We already did all of these beautiful interactive pieces that are embedded into sites via iFrames.

A lot of times the content is hosted locally at the client’s website, and the choice of iFrames is such that integration is easier (cross-code CSS pollution is a nightmare to fix).

At other times, the content is distributed to blogs, etc. and other content portals to use as part of their visualization work. Examples include the GE2015 visualization and more recently the 2016 Budget one.

I was thinking – why not turn all of these into a proper service?

You do not have to worry about code or infrastructure of any sort. Just give us your brief and we can work out and deliver an interactive piece that not only you can embed on your website, but any other blog can embed on their site.

What you get:

  • A beautiful interactive and/or animated piece.
  • Our animations and visualizations are typically responsive, and they work on desktops and mobiles/tablets.
  • Hosting and infrastructure is not something you have to worry about – we will take of this on our end. All we do is charge a simple maintenance fee (for a year) for hosting the code art on our servers.
  • Data visualizations can be updated live via live feeds.
  • You do not have to host it on our servers and host this locally on your servers. This typically makes more sense for data products or complicated pieces.
  • Costing wise, we expect that even for a wow-like responsive animation piece, it should be relatively affordable (below S$5K).

Drop us a ping if you’re intrigued!