Skip to content

Group

Type class

Creates an SVG <g> element.

SVG groups are used for elements that need more elements just one.

More info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g About <g> element

Sources

Group can be used (imported) via one of the following packages.

/**
* Import from: "core.ts"
* Use like: am4core.Group
*/
import * as am4core from "@amcharts/amcharts4/core";

Inheritance

Group extends AMElement.

Group is not extended by any other symbol.

Properties

content

Type string

Content of the group element.

Can be used to add a lot of proprietary SVG markup into group.

6 inherited items
node

Type SVGSVGElementInherited from AMElement

An SVG node of the element.

rotation

Type numberInherited from AMElement

Element's rotation in degrees.

scale

Type numberInherited from AMElement

Element's scale where 1 is original size.

Setting to 0.5 will reduce element's size by 50%, 2 will make element twice as large, etc.

textContent

Type stringInherited from AMElement

Text contents of the SVG element.

x

Type numberInherited from AMElement

Element's X position in pixels.

y

Type numberInherited from AMElement

Element's Y position in pixels.

Methods

add(element: AMElement)

Returns void

Adds an element to group.

This will manipulate DOM. element will be physically moved into group.

addToBack(element: AMElement)

Returns void

Adds an element to group.

This will manipulate DOM. element will be physically moved into group.

constructor(elementName: string)

Returns Group

Constructor.

hasChild(element: AMElement)

Returns boolean

Checks if this group already has the child element added

removeChildren()

Returns void

Removes all children from the group.

removeElement(element: AMElement)

Returns void

Removes the element from group.

Please note that this will not dispose the element itself, it will just remove it from the group.

17 inherited items
addClass(name: string)

Returns voidInherited from AMElement

Adds a class to element.

addStyle(attributes: Object)

Returns AMElementInherited from AMElement

Adds style attributes to element's node.

attr(attributes: ISVGAttribute)

Returns AMElementInherited from AMElement

Sets a set of attributes on a element.

attrNS(ns: string,
attribute: string,
value: string
)

Returns AMElementInherited from AMElement

Sets a single attribute of the element's node using namesspace.

dispose()

Returns voidInherited from AMElement

Disposes element.

getAttr(attribute: string)

Returns string | nullInherited from AMElement

Returns a value of a node attribute.

getAttrNS(ns: string,
attribute: string
)

Returns stringInherited from AMElement

Returns a namespaced attribute value from node.

getBBox()

Returns IRectangleInherited from AMElement

Returns bounding box of the element.

ATTENTION: Bounding box calculations are extremely costly so should be used sparingly and cached whenever possible.

getStyle(attribute: string)

Returns stringInherited from AMElement

Returns style attribute value.

isDisposed()

Returns booleanInherited from AMElement

Was this element already been disposed?

moveTo(point: IPoint)

Returns voidInherited from AMElement

Moves the element to new coordinates.

removeAttr(attribute: string)

Returns voidInherited from AMElement

Removes an attribute from element.

removeChildNodes()

Returns voidInherited from AMElement

Removes all element's child nodes, basically leaving it empty.

removeClass(name: string)

Returns voidInherited from AMElement

Removes a class from element.

removeNode()

Returns voidInherited from AMElement

Removes element's node from DOM.

removeStyle(attribute: string)

Returns voidInherited from AMElement

Removes style attribute from node.

setClass(name: string)

Returns voidInherited from AMElement

Sets a class name on element.

Events

Group does not have any events.