Added type selector to histogram.

In the process, the replacement for the js
lib's ChartState were implemented for the
histogram.