User analytics: simplify histogram creating method

It is much easier to read if there is only one logic block which gets
parameterized depending on the chosen interval. There is no performance
loss I could measure.

In addition to that, this commit adds a documentation for this method.

This relates to issue #596.