class_docstr: Svg related methods
class_docstr_tok: ["Svg","related","methods"]
docstr: Create the svg helper with the chart instance
docstr_tok: ["Create","the","svg","helper","with","the","chart","instance"]
code: def __init__(self, graph):
      """Create the svg helper with the chart instance"""
      self.graph = graph
      if not graph.no_prefix:
          self.id = "#chart-%s " % graph.uuid
      else:
          self.id = ""
      self.processing_instructions = []
      if etree.lxml:
          attrs = {"nsmap": {None: self.ns, "xlink": self.xlink_ns}}
      else:
          attrs = {"xmlns": self.ns}
          if hasattr(etree, "register_namespace"):
              etree.register_namespace("xlink", self.xlink_ns)
          else:
              etree._namespace_map[self.xlink_ns] = "xlink"
  
      self.root = etree.Element("svg", **attrs)
      self.root.attrib["id"] = self.id.lstrip("#").rstrip()
      if graph.classes:
          self.root.attrib["class"] = " ".join(graph.classes)
      self.root.append(
          etree.Comment(
              "Generated with pygal %s (%s) ©Kozea 2012-2016 on %s"
              % (
                  __version__,
                  "lxml" if etree.lxml else "etree",
                  date.today().isoformat(),
              )
          )
      )
      self.root.append(etree.Comment("http://pygal.org"))
      self.root.append(etree.Comment("http://github.com/Kozea/pygal"))
      self.defs = self.node(tag="defs")
      self.title = self.node(tag="title")
      self.title.text = graph.title or "Pygal"
  
      for def_ in self.graph.defs:
          self.defs.append(etree.fromstring(def_))
  
imports: from __future__ import division
  import io
  import json
  import os
  from datetime import date, datetime
  from math import pi
  from numbers import Number
  from urllib.parse import quote_plus
  from pygal import __version__
  from pygal.etree import etree
  from pygal.util import coord_abs_project, coord_diff, coord_dual, coord_format, coord_project, minify_css, template
label_desc: Use image node_id 1 to create a new Svg object from inherited base classes: object with example: obj = Svg(graph)