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 the go.Figure data based on changed x-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.
  *x_ranges: iterable
      A iterable list of current x-ranges, where each x-range is a tuple of two
      items, indicating the current/new (if changed) left-right x-range,
      respectively.
  fore_update: bool
      Whether an update of all traces will be forced, by default False.
docstr_tok: ["Update","the","the","go.Figure","data","based","on","changed","x-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",".","*","x_ranges",":","iterable","A","iterable","list","of","current","x-ranges",",","where","each","x-range","is","a","tuple","of","two","items",",","indicating","the","current\/new","(","if","changed",")","left-right","x-range",",","respectively",".","fore_update",":","bool","Whether","an","update","of","all","traces","will","be","forced",",","by","default","False","."]
code: def _update_x_ranges(
      self, layout, *x_ranges, force_update: bool = False
  ):
      """Update the the go.Figure data based on changed x-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.
      *x_ranges: iterable
          A iterable list of current x-ranges, where each x-range is a tuple of two
          items, indicating the current/new (if changed) left-right x-range,
          respectively.
      fore_update: bool
          Whether an update of all traces will be forced, by default False.
      """
      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, x_range in zip(self._xaxis_list, x_ranges):
          # We also check whether "range" is within the xaxis its layout otherwise
          # It is most-likely an autorange check
          if (
              "range" in layout[xaxis_str]
              and self._prev_layout[xaxis_str].get("range", [])
              != x_range
              or (force_update and x_range is not None)
          ):
              # a change took place -> add to the relayout dict
              relayout_dict[f"{xaxis_str}.range[0]"] = x_range[0]
              relayout_dict[f"{xaxis_str}.range[1]"] = x_range[1]
  
              # An update will take place for that trace
              # -> save current xaxis range to _prev_layout
              self._prev_layout[xaxis_str]["range"] = x_range
  
      if relayout_dict:  # when not empty
          # Construct the update data
          update_data = self._construct_update_data(relayout_dict)
  
          if self._is_no_update(update_data):
              # Return when no data update
              return
  
          if self._print_verbose:
              self._relayout_hist.append(
                  dict(zip(self._xaxis_list, x_ranges))
              )
              self._relayout_hist.append(layout)
              self._relayout_hist.append(
                  ["xaxis-range-update", len(update_data) - 1]
              )
              self._relayout_hist.append("-" * 30)
  
          with self.batch_update():
              # First update the layout (first item of update_data)
              self.layout.update(self._parse_relayout(update_data[0]))
  
              for xaxis_str in self._xaxis_list:
                  if "showspikes" in layout[xaxis_str]:
                      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)
  
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 2 for calling the FigureWidgetResampler obj's underlying member method code with example usage: obj._update_x_ranges(layout) without return types