class_docstr: Abstract interface for data aggregation functionality for plotly figures.
class_docstr_tok: ["Abstract","interface","for","data","aggregation","functionality","for","plotly","figures","."]
docstr: Create the `hf_data` dict which will be put in the `_hf_data` property.
  
  Parameters
  ----------
  dc : _hf_data_container
      The hf_data container, withholding the parsed hf-data.
  trace : BaseTraceType
      The trace.
  downsampler : AbstractAggregator | None
      The downsampler which will be used.
  gap_handler : AbstractGapHandler | None
      The gap handler which will be used.
  max_n_samples : int | None
      The max number of output samples.
  
  Returns
  -------
  dict
      The hf_data dict.
docstr_tok: ["Create","the","`","hf_data","`","dict","which","will","be","put","in","the","`","_hf_data","`","property",".","Parameters","--","--","--","--","--","dc",":","_hf_data_container","The","hf_data","container",",","withholding","the","parsed","hf-data",".","trace",":","BaseTraceType","The","trace",".","downsampler",":","AbstractAggregator","|","None","The","downsampler","which","will","be","used",".","gap_handler",":","AbstractGapHandler","|","None","The","gap","handler","which","will","be","used",".","max_n_samples",":","int","|","None","The","max","number","of","output","samples",".","Returns","--","--","--","-","dict","The","hf_data","dict","."]
code: def _construct_hf_data_dict(
      self,
      dc: _hf_data_container,
      trace: BaseTraceType,
      downsampler: AbstractAggregator | None,
      gap_handler: AbstractGapHandler | None,
      max_n_samples: int | None,
      offset=0,
  ) -> dict:
      """Create the `hf_data` dict which will be put in the `_hf_data` property.
  
      Parameters
      ----------
      dc : _hf_data_container
          The hf_data container, withholding the parsed hf-data.
      trace : BaseTraceType
          The trace.
      downsampler : AbstractAggregator | None
          The downsampler which will be used.
      gap_handler : AbstractGapHandler | None
          The gap handler which will be used.
      max_n_samples : int | None
          The max number of output samples.
  
      Returns
      -------
      dict
          The hf_data dict.
      """
      # Checking this now avoids less interpretable `KeyError` when resampling
      assert_text = (
          "In order to perform time series aggregation, the data must be "
          "sorted in time; i.e., the x-data must be (non-strictly) "
          "monotonically increasing."
      )
      if isinstance(dc.x, pd.Index):
          assert dc.x.is_monotonic_increasing, assert_text
      else:
          assert pd.Series(dc.x).is_monotonic_increasing, assert_text
  
      # As we support prefix-suffixing of downsampled data, we assure that
      # each trace has a name
      # https://github.com/plotly/plotly.py/blob/ce0ed07d872c487698bde9d52e1f1aadf17aa65f/packages/python/plotly/plotly/basedatatypes.py#L539
      # The link above indicates that the trace index is derived from `data`
      if trace.name is None:
          trace.name = f"trace {len(self.data) + offset}"
  
      # Determine (1) the axis type and (2) the downsampler instance
      # & (3) store a hf_data entry for the corresponding trace,
      # identified by its UUID
      axis_type = (
          "date"
          if isinstance(dc.x, pd.DatetimeIndex)
          or pd.core.dtypes.common.is_datetime64_any_dtype(dc.x)
          else "linear"
      )
  
      default_n_samples = False
      if max_n_samples is None:
          default_n_samples = True
          max_n_samples = self._global_n_shown_samples
  
      default_downsampler = False
      if downsampler is None:
          default_downsampler = True
          downsampler = self._global_downsampler
  
      default_gap_handler = False
      if gap_handler is None:
          default_gap_handler = True
          gap_handler = self._global_gap_handler
  
      # TODO -> can't we just store the DC here (might be less duplication of
      #  code knowledge, because now, you need to know all the eligible hf_keys in
      #  dc
      return {
          "max_n_samples": max_n_samples,
          "default_n_samples": default_n_samples,
          "name": trace.name,
          "axis_type": axis_type,
          "downsampler": downsampler,
          "default_downsampler": default_downsampler,
          "gap_handler": gap_handler,
          "default_gap_handler": default_gap_handler,
          **dc._asdict(),
      }
  
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 12 for calling the AbstractFigureAggregator obj's underlying member method code with example usage: obj._construct_hf_data_dict(dc, trace, downsampler, gap_handler, max_n_samples, offset) and returns: dict