class_docstr: Data aggregation functionality wrapper for ``go.FigureWidgets``.
  
  !!! warning
  
      * This wrapper only works within ``jupyter``-based environments.
      * The ``.show()`` method returns a **static figure** on which the
        **dynamic resampling cannot be performed**. To allow dynamic resampling,
        you should just output the ``FigureWidgetResampler`` object in a cell.
class_docstr_tok: ["Data","aggregation","functionality","wrapper","for","``","go.FigureWidgets","``",".","!","!","!","warning","*","This","wrapper","only","works","within","``","jupyter","``","-based","environments",".","*","The","``",".show","(",")","``","method","returns","a","*","*","static","figure","*","*","on","which","the","*","*","dynamic","resampling","can","not","be","performed","*","*",".","To","allow","dynamic","resampling",",","you","should","just","output","the","``","FigureWidgetResampler","``","object","in","a","cell","."]
docstr: Update the go.Figure based on the changed spike-ranges.
  
  Parameters
  ----------
  layout : go.Layout
      The figure's (i.e, self) layout object. Remark that this is a reference,
      so if we change self.layout (same object reference), this object will
      change.
  *showspikes: iterable
      A iterable where each item is a bool, indicating  whether showspikes is set
      to true/false for the corresponding xaxis in ``self._xaxis_list``.
  force_update: bool
      Bool indicating whether the range updates need to take place. This is
      especially useful when you have recently updated the figure its data (with
      the hf_data property) and want to perform an autoscale, independent from
      the current figure-layout.
docstr_tok: ["Update","the","go.Figure","based","on","the","changed","spike-ranges",".","Parameters","--","--","--","--","--","layout",":","go.Layout","The","figure","'s","(","i.e",",","self",")","layout","object",".","Remark","that","this","is","a","reference",",","so","if","we","change","self.layout","(","same","object","reference",")",",","this","object","will","change",".","*","showspikes",":","iterable","A","iterable","where","each","item","is","a","bool",",","indicating","whether","showspikes","is","set","to","true\/false","for","the","corresponding","xaxis","in","``","self._xaxis_list","``",".","force_update",":","bool","Bool","indicating","whether","the","range","updates","need","to","take","place",".","This","is","especially","useful","when","you","have","recently","updated","the","figure","its","data","(","with","the","hf_data","property",")","and","want","to","perform","an","autoscale",",","independent","from","the","current","figure-layout","."]
code: def _update_spike_ranges(
      self, layout, *showspikes, force_update=False
  ):
      """Update the go.Figure based on the changed spike-ranges.
  
      Parameters
      ----------
      layout : go.Layout
          The figure's (i.e, self) layout object. Remark that this is a reference,
          so if we change self.layout (same object reference), this object will
          change.
      *showspikes: iterable
          A iterable where each item is a bool, indicating  whether showspikes is set
          to true/false for the corresponding xaxis in ``self._xaxis_list``.
      force_update: bool
          Bool indicating whether the range updates need to take place. This is
          especially useful when you have recently updated the figure its data (with
          the hf_data property) and want to perform an autoscale, independent from
          the current figure-layout.
      """
      relayout_dict = (
          {}
      )  # variable in which we aim to reconstruct the relayout
      # serialize the layout in a new dict object
      layout = {
          xaxis_str: layout[xaxis_str].to_plotly_json()
          for xaxis_str in self._xaxis_list
      }
  
      if self._prev_layout is None:
          self._prev_layout = layout
  
      for xaxis_str, showspike in zip(self._xaxis_list, showspikes):
          if (
              force_update
              or
              # autorange key must be set to True
              (
                  layout[xaxis_str].get("autorange", False)
                  # we only perform updates for traces which have 'range' property,
                  # as we do need to reconstruct the update-data for these traces
                  and self._prev_layout[xaxis_str].get("range", None)
                  is not None
              )
          ):
              relayout_dict[f"{xaxis_str}.autorange"] = True
              relayout_dict[f"{xaxis_str}.showspikes"] = showspike
              # autorange -> we pop the xaxis range
              if "range" in layout[xaxis_str]:
                  del layout[xaxis_str]["range"]
  
      if len(relayout_dict):
          # An update will take place, save current layout to _prev_layout
          self._prev_layout = layout
  
          # Construct the update data
          update_data = self._construct_update_data(relayout_dict)
          if self._print_verbose:
              self._relayout_hist.append(layout)
              self._relayout_hist.append(
                  ["showspikes-update", len(update_data) - 1]
              )
              self._relayout_hist.append("-" * 30)
  
          with self.batch_update():
              # First update the layout (first item of update_data)
              if not force_update:
                  self.layout.update(
                      self._parse_relayout(update_data[0])
                  )
  
              # Also:  Remove the showspikes from the layout, otherwise the autorange
              # will not work as intended (it will not be triggered again)
              # Note: this removal causes a second trigger of this method
              # which will go in the "else" part below.
              for xaxis_str in self._xaxis_list:
                  self.layout[xaxis_str].pop("showspikes")
  
              # Then, update the data
              for updated_trace in update_data[1:]:
                  trace_idx = updated_trace.pop("index")
                  self.data[trace_idx].update(updated_trace)
      elif self._print_verbose:
          self._relayout_hist.append(
              ["showspikes", "initial call or showspikes"]
          )
          self._relayout_hist.append("-" * 40)
  
file_path: plotly-resampler/plotly_resampler/figure_resampler/figurewidget_resampler.py
imports: from __future__ import annotations
  from typing import Tuple
  import plotly.graph_objects
  from plotly.basedatatypes import BaseFigure
  from ..aggregation import AbstractAggregator, AbstractGapHandler, MedDiffGapHandler, MinMaxLTTB
  from .figure_resampler_interface import AbstractFigureAggregator
label_desc: Use image node_id 3 for calling the FigureWidgetResampler obj's underlying member method code with example usage: obj._update_spike_ranges(layout) without return types