code: def apply(self, dataset, flat=False, expanded=None, ranges={}, all_values=False):
          
          dimension = self.dimension
          if expanded is None:
              expanded = not ((dataset.interface.gridded and dimension in dataset.kdims) or
                              (dataset.interface.multi and dataset.interface.isscalar(dataset, dimension)))
          if isinstance(dataset, Graph):
              if dimension in dataset.kdims and all_values:
                  dimension = dataset.nodes.kdims[2]
              dataset = dataset if dimension in dataset else dataset.nodes
          data = dataset.dimension_values(dimension, expanded=expanded, flat=flat)
          for o in self.ops:
              args = o['args']
              fn_args = [data]
              for arg in args:
                  if isinstance(arg, dim):
                      arg = arg.apply(dataset, flat, expanded, ranges, all_values)
                  fn_args.append(arg)
              args = tuple(fn_args[::-1] if o['reverse'] else fn_args)
              eldim = dataset.get_dimension(dimension)
              drange = ranges.get(eldim.name, {})
              drange = drange.get('combined', drange)
              kwargs = o['kwargs']
              if o['fn'] is norm and drange != {} and not ('min' in kwargs and 'max' in kwargs):
                  data = o['fn'](data, *drange)
              else:
                  data = o['fn'](*args, **kwargs)
          return data
docs: Evaluates the transform on the supplied dataset.
  
          Args:
              dataset: Dataset object to evaluate the expression on
              flat: Whether to flatten the returned array
              expanded: Whether to use the expanded expand values
              ranges: Dictionary for ranges for normalization
              all_values: Whether to evaluate on all values
                 Whether to evaluate on all available values, for some
                 element types, such as Graphs, this may include values
                 not included in the referenced column
  
          Returns:
              values: NumPy array computed by evaluating the expression