histogram directive implementation