def __getitem__(self, key):
        if key in self.dimensions(): return self.dimension_values(key)
        if key is () or key is Ellipsis: return self # May no longer be necessary
        key = util.process_ellipses(self, key)
        if not isinstance(key, tuple): pass
        elif len(key) == self.ndims + 1:
            if key[-1] != slice(None) and (key[-1] not in self.vdims):
                raise KeyError("%r is the only selectable value dimension" %
                                self.vdims[0].name)
            key = key[0]
        elif len(key) == self.ndims + 1: key = key[0]
        else:
            raise KeyError("Histogram cannot slice more than %d dimension."
                            % len(self.kdims)+1)

        centers = [(float(l)+r)/2 for (l,r) in zip(self.edges, self.edges[1:])]
        if isinstance(key, slice):
            start, stop = key.start, key.stop
            if [start, stop] == [None,None]: return self
            start_idx, stop_idx = None,None
            if start is not None:
                start_idx = np.digitize([start], centers, right=True)[0]
            if stop is not None:
                stop_idx = np.digitize([stop], centers, right=True)[0]

            slice_end = stop_idx+1 if stop_idx is not None else None
            slice_values = self.values[start_idx:stop_idx]
            slice_edges =  self.edges[start_idx: slice_end]

            extents = (min(slice_edges), self.extents[1],
                       max(slice_edges), self.extents[3])
            return self.clone((slice_values, slice_edges), extents=extents)
        else:
            if not (self.edges.min() <= key < self.edges.max()):
                raise KeyError("Key value %s is out of the histogram bounds" % key)
            idx = np.digitize([key], self.edges)[0]
            return self.values[idx-1 if idx>0 else idx]
Implements slicing or indexing of the Histogram
dataset/ETHPy150Open ioam/holoviews/holoviews/element/chart.py/Histogram.__getitem__