Make histogram configured in JSON.
Make pie configured in JSON.

Add documentation.
Refactor a bit.