refactor code for restructuring data for nvd3 histogram chart

This should address some of the issue that have come up regarding the visualize data graphs in orgs.