class_docstr: **Bases:** :class:`PlotItem <pyqtgraph.PlotItem>`
  
  :class:`ColorBarItem` controls the application of a 
  :ref:`color map <apiref_colormap>` to one (or more) 
  :class:`~pyqtgraph.ImageItem`. It is a simpler, compact alternative to 
  :class:`~pyqtgraph.HistogramLUTItem`, without histogram or the 
  option to adjust the colors of the look-up table.
  
  A labeled axis is displayed directly next to the gradient to help identify values.
  Handles included in the color bar allow for interactive adjustment.
  
  A ColorBarItem can be assigned one or more :class:`~pyqtgraph.ImageItem` s 
  that will be displayed according to the selected color map and levels. The
  ColorBarItem can be used as a separate element in a 
  :class:`~pyqtgraph.GraphicsLayout` or added to the layout of a 
  :class:`~pyqtgraph.PlotItem` used to display image data with coordinate axes.
  
  =============================  =============================================
  **Signals:**
  sigLevelsChanged(self)         Emitted when the range sliders are moved
  sigLevelsChangeFinished(self)  Emitted when the range sliders are released
  =============================  =============================================
class_docstr_tok: ["*","*","Bases",":","*","*",":","class",":","`","PlotItem","<","pyqtgraph.PlotItem",">","`",":","class",":","`","ColorBarItem","`","controls","the","application","of","a",":","ref",":","`","color","map","<","apiref_colormap",">","`","to","one","(","or","more",")",":","class",":","`","~pyqtgraph.ImageItem","`",".","It","is","a","simpler",",","compact","alternative","to",":","class",":","`","~pyqtgraph.HistogramLUTItem","`",",","without","histogram","or","the","option","to","adjust","the","colors","of","the","look-up","table",".","A","labeled","axis","is","displayed","directly","next","to","the","gradient","to","help","identify","values",".","Handles","included","in","the","color","bar","allow","for","interactive","adjustment",".","A","ColorBarItem","can","be","assigned","one","or","more",":","class",":","`","~pyqtgraph.ImageItem","`","s","that","will","be","displayed","according","to","the","selected","color","map","and","levels",".","The","ColorBarItem","can","be","used","as","a","separate","element","in","a",":","class",":","`","~pyqtgraph.GraphicsLayout","`","or","added","to","the","layout","of","a",":","class",":","`","~pyqtgraph.PlotItem","`","used","to","display","image","data","with","coordinate","axes",".","=============================","=============================================","*","*","Signals",":","*","*","sigLevelsChanged","(","self",")","Emitted","when","the","range","sliders","are","moved","sigLevelsChangeFinished","(","self",")","Emitted","when","the","range","sliders","are","released","=============================","============================================="]
docstr: internal: recalculate levels based on new position of adjusters 
docstr_tok: ["internal",":","recalculate","levels","based","on","new","position","of","adjusters"]
code: def _regionChanging(self):
      """internal: recalculate levels based on new position of adjusters"""
      if not self.region_changed_enable:
          return
      bot, top = self.region.getRegion()
      bot = (bot - 63) / 64  # -1 to +1 over half-bar range
      top = (top - 191) / 64  # -1 to +1 over half-bar range
      bot = math.copysign(
          bot**2, bot
      )  # quadratic behaviour for sensitivity to small changes
      top = math.copysign(top**2, top)
      # These are the new values if adjuster is released now, rate of change depends on original separation
      span_prv = self.hi_prv - self.lo_prv  # previous span of values
      hi_new = (
          self.hi_prv + (span_prv + 2 * self.rounding) * top
      )  # make sure that we can always
      lo_new = (
          self.lo_prv + (span_prv + 2 * self.rounding) * bot
      )  # reach 2x the minimal step
  
      # Alternative model with speed depending on level magnitude:
      # mean_val = abs(self.lo_prv) + abs(self.hi_prv) / 2
      # hi_new = self.hi_prv + (mean_val + 2*self.rounding) * top # make sure that we can always
      # lo_new = self.lo_prv + (mean_val + 2*self.rounding) * bot #    reach 2x the minimal step
  
      if self.hi_lim is not None:
          if hi_new > self.hi_lim:  # limit maximum value
              hi_new = self.hi_lim
              if top != 0 and bot != 0:  # moving entire region?
                  lo_new = (
                      hi_new - span_prv
                  )  # avoid collapsing the span against top limit
      if self.lo_lim is not None:
          if lo_new < self.lo_lim:  # limit minimum value
              lo_new = self.lo_lim
              if top != 0 and bot != 0:  # moving entire region?
                  hi_new = (
                      lo_new + span_prv
                  )  # avoid collapsing the span against bottom limit
      if (
          hi_new - lo_new < self.rounding
      ):  # do not allow less than one "rounding" unit of span
          if bot == 0:
              hi_new = lo_new + self.rounding
          elif top == 0:
              lo_new = hi_new - self.rounding
          else:  # this should never happen, but let's try to recover if it does:
              mid = (hi_new + lo_new) / 2
              hi_new = mid + self.rounding / 2
              lo_new = mid - self.rounding / 2
  
      lo_new = self.rounding * round(lo_new / self.rounding)
      hi_new = self.rounding * round(hi_new / self.rounding)
      self.values = (lo_new, hi_new)
      self._update_items()
      self.sigLevelsChanged.emit(self)
  
file_path: pyqtgraph/pyqtgraph/graphicsItems/ColorBarItem.py
imports: import math
  import weakref
  import numpy
  from ..None import colormap
  from ..None import functions
  from ..Qt import QtCore, QtGui, QtWidgets
  from .LinearRegionItem import LinearRegionItem
  from .PlotItem import PlotItem
label_desc: Use image node_id 10 for calling the ColorBarItem obj's underlying member method code with example usage: obj._regionChanging() without return types