class_docstr: Abstract interface for data aggregation functionality for plotly figures.
class_docstr_tok: ["Abstract","interface","for","data","aggregation","functionality","for","plotly","figures","."]
docstr: Construct the Patch of the to-be-updated front-end data, based on the layout
  change.
  
  Attention
  ---------
  This method is tightly coupled with Dash app callbacks. It takes the front-end
  figure its ``relayoutData`` as input and returns the ``dash.Patch`` which needs
  to be sent to the ``figure`` property for the corresponding ``dcc.Graph``.
  
  Parameters
  ----------
  relayout_data: dict
      A dict containing the ``relayoutData`` (i.e., the changed layout data) of
      the corresponding front-end graph.
  
  Returns
  -------
  dash.Patch:
      The Patch object containing the figure updates which needs to be sent to
      the front-end.
docstr_tok: ["Construct","the","Patch","of","the","to-be-updated","front-end","data",",","based","on","the","layout","change",".","Attention","--","--","--","--","-","This","method","is","tightly","coupled","with","Dash","app","callbacks",".","It","takes","the","front-end","figure","its","``","relayoutData","``","as","input","and","returns","the","``","dash.Patch","``","which","needs","to","be","sent","to","the","``","figure","``","property","for","the","corresponding","``","dcc.Graph","``",".","Parameters","--","--","--","--","--","relayout_data",":","dict","A","dict","containing","the","``","relayoutData","``","(","i.e.",",","the","changed","layout","data",")","of","the","corresponding","front-end","graph",".","Returns","--","--","--","-","dash.Patch",":","The","Patch","object","containing","the","figure","updates","which","needs","to","be","sent","to","the","front-end","."]
code: def construct_update_data_patch(
      self, relayout_data: dict
  ) -> Union[dash.Patch, dash.no_update]:
      """Construct the Patch of the to-be-updated front-end data, based on the layout
      change.
  
      Attention
      ---------
      This method is tightly coupled with Dash app callbacks. It takes the front-end
      figure its ``relayoutData`` as input and returns the ``dash.Patch`` which needs
      to be sent to the ``figure`` property for the corresponding ``dcc.Graph``.
  
      Parameters
      ----------
      relayout_data: dict
          A dict containing the ``relayoutData`` (i.e., the changed layout data) of
          the corresponding front-end graph.
  
      Returns
      -------
      dash.Patch:
          The Patch object containing the figure updates which needs to be sent to
          the front-end.
  
      """
      update_data = self._construct_update_data(relayout_data)
      if not isinstance(update_data, list) or len(update_data) <= 1:
          return dash.no_update
  
      patched_figure = dash.Patch()  # create patch
      for trace in update_data[
          1:
      ]:  # skip first item as it contains the relayout
          trace_index = trace.pop(
              "index"
          )  # the index of the corresponding trace
          # All the other items are the trace properties which needs to be updated
          for k, v in trace.items():
              # NOTE: we need to use the `patched_figure` as a dict, and not
              # `patched_figure.data` as the latter will replace **all** the
              # data for the corresponding trace, and we just want to update the
              # specific trace its properties.
              patched_figure["data"][trace_index][k] = v
      return patched_figure
  
imports: from __future__ import annotations
  import itertools
  import re
  from abc import ABC
  from collections import namedtuple
  from copy import copy
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  from uuid import uuid4
  import dash
  import numpy
  import pandas
  import plotly.graph_objects
  from pandas.io.json._normalize import nested_to_record
  from plotly.basedatatypes import BaseFigure, BaseTraceType
  from ..aggregation import AbstractAggregator, MedDiffGapHandler, MinMaxLTTB
  from ..aggregation.aggregation_interface import DataPointSelector
  from ..aggregation.gap_handler_interface import AbstractGapHandler
  from ..aggregation.plotly_aggregator_parser import PlotlyAggregatorParser
  from .utils import round_number_str, round_td_str
label_desc: Use image node_id 20 for calling the AbstractFigureAggregator obj's underlying member method code with example usage: obj.construct_update_data_patch(relayout_data) and returns: patched_figure, dash