class_docstr: Mixin class for Cartesian 1D Chart elements to add basic support for
  SelectionExpr streams.
class_docstr_tok: ["Mixin","class","for","Cartesian","1D","Chart","elements","to","add","basic","support","for","SelectionExpr","streams","."]
code: def _get_selection_expr_for_stream_value(self, **kwargs):
      invert_axes = self.opts.get("plot").kwargs.get(
          "invert_axes", False
      )
      if (invert_axes and not self._inverted_expr) or (
          not invert_axes and self._inverted_expr
      ):
          region_el = HSpan
      else:
          region_el = VSpan
  
      if kwargs.get("bounds", None) is None:
          region = (
              None
              if "index_cols" in kwargs
              else NdOverlay({0: region_el()})
          )
          return None, None, region
  
      x0, y0, x1, y1 = kwargs["bounds"]
  
      # Handle invert_xaxis/invert_yaxis
      if y0 > y1:
          y0, y1 = y1, y0
      if x0 > x1:
          x0, x1 = x1, x0
  
      if len(self.dimensions()) == 1:
          xdim = self.dimensions()[0]
          ydim = None
      else:
          xdim, ydim = self.dimensions()[:2]
  
      if invert_axes:
          x0, x1, y0, y1 = y0, y1, x0, x1
          cat_kwarg = "y_selection"
      else:
          cat_kwarg = "x_selection"
  
      if self._inverted_expr:
          if ydim is not None:
              xdim = ydim
          x0, x1 = y0, y1
          cat_kwarg = ("y" if invert_axes else "x") + "_selection"
      cats = kwargs.get(cat_kwarg)
  
      bbox = {xdim.name: (x0, x1)}
      if cats is not None and len(self.kdims) == 1:
          bbox[self.kdims[0].name] = cats
      index_cols = kwargs.get("index_cols")
      if index_cols:
          selection = self.dataset.clone(
              datatype=["dataframe", "dictionary"]
          ).select(**bbox)
          selection_expr = self._get_index_expr(index_cols, selection)
          region_element = None
      else:
          if isinstance(cats, list) and xdim in self.kdims[:1]:
              selection_expr = dim(xdim).isin(cats)
          else:
              selection_expr = (dim(xdim) >= x0) & (dim(xdim) <= x1)
              if isinstance(cats, list) and len(self.kdims) == 1:
                  selection_expr &= dim(self.kdims[0]).isin(cats)
          region_element = NdOverlay({0: region_el(x0, x1)})
      return selection_expr, bbox, region_element
  
imports: import sys
  import numpy
  import pandas
  from ..core import Dataset, NdOverlay, util
  from ..streams import Lasso, Selection1D, SelectionXY
  from ..util.transform import dim
  from .annotation import HSpan, VSpan
label_desc: Use image node_id 2 for calling the Selection1DExpr obj's underlying member method code with example usage: obj._get_selection_expr_for_stream_value() and returns: selection_expr,  bbox,  region_element, None,  None,  region