class_docstr: Abstract interface for data aggregation functionality for plotly figures.
class_docstr_tok: ["Abstract","interface","for","data","aggregation","functionality","for","plotly","figures","."]
docstr: Parse the trace name.
  
  Parameters
  ----------
  hf_trace_data : dict
      The high-frequency trace data dict.
  slice_len : int
      The length of the slice.
  agg_x : np.ndarray
      The x-axis values of the aggregated trace.
  
  Returns
  -------
  str
      The parsed trace name.
      When no downsampling is needed, the original trace name is returned.
      When downsampling is needed, the average bin size (expressed in x-units) is
      added in orange color with a `~` to the trace name.
docstr_tok: ["Parse","the","trace","name",".","Parameters","--","--","--","--","--","hf_trace_data",":","dict","The","high-frequency","trace","data","dict",".","slice_len",":","int","The","length","of","the","slice",".","agg_x",":","np.ndarray","The","x-axis","values","of","the","aggregated","trace",".","Returns","--","--","--","-","str","The","parsed","trace","name",".","When","no","downsampling","is","needed",",","the","original","trace","name","is","returned",".","When","downsampling","is","needed",",","the","average","bin","size","(","expressed","in","x-units",")","is","added","in","orange","color","with","a","`","~","`","to","the","trace","name","."]
code: def _parse_trace_name(
      self, hf_trace_data: dict, slice_len: int, agg_x: np.ndarray
  ) -> str:
      """Parse the trace name.
  
      Parameters
      ----------
      hf_trace_data : dict
          The high-frequency trace data dict.
      slice_len : int
          The length of the slice.
      agg_x : np.ndarray
          The x-axis values of the aggregated trace.
  
      Returns
      -------
      str
          The parsed trace name.
          When no downsampling is needed, the original trace name is returned.
          When downsampling is needed, the average bin size (expressed in x-units) is
          added in orange color with a `~` to the trace name.
  
      """
      if (
          slice_len <= hf_trace_data["max_n_samples"]
      ):  # When no downsampling needed
          return hf_trace_data["name"]
  
      # The data is downsampled, so we add the downsampling information to the name
      agg_prefix, agg_suffix = ' <i style="color:#fc9944">~', "</i>"
      name = self._prefix + hf_trace_data["name"] + self._suffix
  
      # Add the mean aggregation bin size to the trace name
      if self._show_mean_aggregation_size:
          # Base case ...
          if len(agg_x) < 2:
              return name
  
          mean_bin_size = (agg_x[-1] - agg_x[0]) / agg_x.shape[
              0
          ]  # mean bin size
          if isinstance(mean_bin_size, (np.timedelta64, pd.Timedelta)):
              mean_bin_size = round_td_str(pd.Timedelta(mean_bin_size))
          else:
              mean_bin_size = round_number_str(mean_bin_size)
          name += f"{agg_prefix}{mean_bin_size}{agg_suffix}"
      return name
  
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 5 for calling the AbstractFigureAggregator obj's underlying member method code with example usage: obj._parse_trace_name(hf_trace_data, slice_len, agg_x) and returns: name, hf_trace_data, name