Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SvgHelper

Utility class to simplify SVG operations.

Hierarchy

  • SvgHelper

Index

Methods

Static createCircle

  • createCircle(radius: number, attributes?: Array<[]>): SVGCircleElement
  • Creates an SVG circle with the specified radius.

    Parameters

    • radius: number
    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGCircleElement

Static createDefs

  • createDefs(): SVGDefsElement
  • Creates SVG "defs".

    Returns SVGDefsElement

Static createEllipse

  • createEllipse(rx: number, ry: number, attributes?: Array<[]>): SVGEllipseElement
  • Creates an SVG ellipse with the specified horizontal and vertical radii.

    Parameters

    • rx: number
    • ry: number
    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGEllipseElement

Static createGroup

  • createGroup(attributes?: Array<[]>): SVGGElement
  • Creates an SVG group.

    Parameters

    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGGElement

Static createImage

  • createImage(attributes?: Array<[]>): SVGImageElement
  • Creates an SVG image element.

    Parameters

    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGImageElement

Static createLine

  • createLine(x1: number | string, y1: number | string, x2: number | string, y2: number | string, attributes?: Array<[]>): SVGLineElement
  • Creates an SVG line with specified end-point coordinates.

    Parameters

    • x1: number | string
    • y1: number | string
    • x2: number | string
    • y2: number | string
    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGLineElement

Static createMarker

  • createMarker(id: string, orient: string, markerWidth: number | string, markerHeight: number | string, refX: number | string, refY: number | string, markerElement: SVGGraphicsElement): SVGMarkerElement
  • Creates an SVG marker.

    Parameters

    • id: string
    • orient: string
    • markerWidth: number | string
    • markerHeight: number | string
    • refX: number | string
    • refY: number | string
    • markerElement: SVGGraphicsElement

    Returns SVGMarkerElement

Static createPath

  • createPath(d: string, attributes?: Array<[]>): SVGPathElement
  • Creates an SVG path with the specified shape (d).

    Parameters

    • d: string

      path shape

    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGPathElement

Static createPoint

  • createPoint(x: number, y: number): SVGPoint
  • Creates an SVG point with the specified coordinates.

    Parameters

    • x: number
    • y: number

    Returns SVGPoint

Static createPolygon

  • createPolygon(points: string, attributes?: Array<[]>): SVGPolygonElement
  • Creates an SVG polygon with specified points.

    Parameters

    • points: string

      points as string.

    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGPolygonElement

Static createRect

  • createRect(width: number | string, height: number | string, attributes?: Array<[]>): SVGRectElement
  • Creates an SVG rectangle with the specified width and height.

    Parameters

    • width: number | string
    • height: number | string
    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGRectElement

Static createTSpan

  • createTSpan(text: string, attributes?: Array<[]>): SVGTSpanElement
  • Creates an SVG TSpan.

    Parameters

    • text: string

      inner text.

    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGTSpanElement

Static createText

  • createText(attributes?: Array<[]>): SVGTextElement
  • Creaes an SVG text element.

    Parameters

    • Optional attributes: Array<[]>

      additional attributes.

    Returns SVGTextElement

Static createTransform

  • createTransform(): SVGTransform
  • Creates an SVG transform.

    Returns SVGTransform

Static setAttributes

  • setAttributes(el: SVGElement, attributes: Array<[]>): void
  • Sets attributes on an arbitrary SVG element

    Parameters

    • el: SVGElement

      target SVG element.

    • attributes: Array<[]>

      set of name-value attribute pairs.

    Returns void

Generated using TypeDoc