class_docstr: Chart internal behaviour related functions
class_docstr_tok: ["Chart","internal","behaviour","related","functions"]
docstr: Set up the transient state prior rendering
docstr_tok: ["Set","up","the","transient","state","prior","rendering"]
code: def setup(self, **kwargs):
      """Set up the transient state prior rendering"""
      # Keep labels in case of map
      if getattr(self, "x_labels", None) is not None:
          self.x_labels = list(self.x_labels)
      if getattr(self, "y_labels", None) is not None:
          self.y_labels = list(self.y_labels)
      self.state = State(self, **kwargs)
      if isinstance(self.style, type):
          self.style = self.style()
      self.series = (
          self.prepare_values(
              [
                  rs
                  for rs in self.raw_series
                  if not rs[1].get("secondary")
              ]
          )
          or []
      )
      self.secondary_series = (
          self.prepare_values(
              [rs for rs in self.raw_series if rs[1].get("secondary")],
              len(self.series),
          )
          or []
      )
      self.horizontal = getattr(self, "horizontal", False)
      self.svg = Svg(self)
      self._x_labels = None
      self._y_labels = None
      self._x_2nd_labels = None
      self._y_2nd_labels = None
      self.nodes = {}
      self.margin_box = Margin(
          self.margin_top or self.margin,
          self.margin_right or self.margin,
          self.margin_bottom or self.margin,
          self.margin_left or self.margin,
      )
      self._box = Box()
      self.view = None
      if self.logarithmic and self.zero == 0:
          # Explicit min to avoid interpolation dependency
          positive_values = list(
              filter(
                  lambda x: x > 0,
                  [
                      val[1] or 1 if self._dual else val
                      for serie in self.series
                      for val in serie.safe_values
                  ],
              )
          )
  
          self.zero = min(positive_values or (1,)) or 1
      if self._len < 3:
          self.interpolate = None
      self._draw()
      self.svg.pre_render()
  
imports: import os
  from functools import reduce
  from uuid import uuid4
  from pygal._compat import is_list_like
  from pygal.adapters import decimal_to_float, not_zero, positive
  from pygal.config import Config, SerieConfig
  from pygal.serie import Serie
  from pygal.state import State
  from pygal.svg import Svg
  from pygal.util import compose, ident
  from pygal.view import Box, Margin
label_desc: Use image node_id 5 for calling the BaseGraph obj's underlying member method code with example usage: obj.setup() without return types