AnyChart
API Reference
Still have questions?
Contact support
Top

class anychart.graphics.vector.Stage Improve this Doc

This class provide tools for cross-browser display with the single interface for both (SVG and VML).
Do not invoke constructor directly. Use anychart.graphics#create.

Note:
anychart.graphics.vector.Stage delegates all work with DOM elements, style and attributes to its renderer. You can get renderer using getRenderer method.
Note: Renderer is a singleton must not contain own fields.

Rendering:
anychart.graphics.vector.Stage has the rootLayer_ private field of Layer type. All layers and elements you add to a stage go there, so rendering and other stuff happens when this layer is rendered.

Methods Overview

Drawing
asyncMode()Stage rendering mode.
circle()Invokes anychart.graphics.vector.Circle constructor.
clip()Gets clip bounds.
container()Container settings.
createClip()Creates a clip element using single value.
dispose()Disposes stage.
ellipse()Invokes anychart.graphics.vector.Ellipse constructor.
hatchFill()Invokes anychart.graphics.vector.HatchFill constructor.
html()Invokes anychart.graphics.vector.Text and applies anychart.graphics.vector.Text#htmlText method
image()Invokes anychart.graphics.vector.Image constructor.
isRendering()Indicates if stage is in rendering process.
isSuspended()Returns rendering state (true - suspended, false - instant).
layer()Invokes anychart.graphics.vector.Layer constructor.
path()Invokes anychart.graphics.vector.Path constructor.
pattern()Invokes anychart.graphics.vector.PatternFill.
resume()Removes suspend state and applies all changes in sync (if any).
suspend()Suspends rendering (changes instant to suspended).
text()Invokes anychart.graphics.vector.Text constructor.
Events
listen()Adds an event listener to a stage.
listenOnce()Adds an event listener that is removed automatically after the listener fired once.
removeAllListeners()Removes all listeners from an object. You can also optionally remove listeners of some particular type.
unlisten()Removes a listener added with anychart.graphics.vector.Stage#listen or anychart.graphics.vector.Stage#listenOnce methods.
unlistenByKey()Removes an event listener which was added with anychart.graphics.vector.Stage#listen by the key returned by
Export
data()Returns stage JSON. Serializes stage and all its object to JSON.
getJpgBase64String()Returns JPG as base64 string.
getPdfBase64String()Returns PDF as base64 string.
getPngBase64String()Returns PNG as base64 string.
getSvgBase64String()Returns SVG as base64 string.
print()Print stage.
saveAsJpg()Saves the stage as JPG Image.
saveAsPdf()Saves the stage as PDF Document.
saveAsPng()Saves the stage as PNG Image.
saveAsSvg()Saves the stage as SVG Image.
shareAsJpg()Share a stage as a JPG and return link to shared image.
shareAsPdf()Share a stage as a PDF and return link to shared image.
shareAsPng()Shares a stage as a PNG file and returns a link to the shared image.
shareAsSvg()Share a stage as a SVG and return link to shared image.
toSvg()Returns SVG string
Predefined Visual Elements
cross()Draws a cross defined by a circumscribed circle.
diagonalCross()Draws a diagonal cross set by it circumscribed circle center and radius.
diamond()Draws a diamond set by it circumscribed circle center and radius.
donut()Draws arc as donut chart element.
hLine()Draws a thick horizontal line set by its circumscribed circle center and radius.
pie()Draws arc as pie chart element.
rect()Invokes anychart.graphics.vector.Rect constructor.
roundedInnerRect()Draws rectangle with inner rounded corners.
roundedRect()Draws rectangle with rounded corners.
star()Draws multi-pointed star.
star10()Draws ten-pointed star.
star4()Draws four-pointed star.
star5()Draws five-pointed star.
star6()Draws six-pointed star.
star7()Draws seven-pointed star.
triangleDown()Draws a triangle heading downwards set by it circumscribed circle center and radius.
triangleLeft()Draws a triangle heading leftwards set by it circumscribed circle center and radius.
triangleRight()Draws a triangle heading rightwards set by it circumscribed circle center and radius.
triangleUp()Draws a triangle heading upwards set by its circumscribed circle center and radius.
truncatedRect()Draws rectangle with truncated corners.
vLine()Draws a thick vertical line set by its circumscribed circle center and radius.
Size and Position
getBounds()Returns bounds.
getX()Returns X of top left corner.
getY()Returns Y of top left corner.
height()Stage height.
resize()Stage resize. Anything drawn on stage must fit in it.
rotate()Rotates root layer.
rotateByAnchor()Rotates root layer around an anchor.
setPosition()Sets top left corner coordinates of root layer (with transformation,in parent coordinate system).
setRotation()Rotates root layer around a point.
setRotationByAnchor()Rotates root layer around an anchor.
width()Stage width.
Structure
addChild()Adds an element.
addChildAt()Adds an element by index.
domElement()Returns stage root DOM element.
forEachChild()Applies function to all children.
getChildAt()Returns an element by index.
getContainerElement()Returns stage container element.
getDomWrapper()Returns a DIV wrapper that contains stage and other utilitarian DOM elements.
getStage()Returns self.
hasChild()Checks if there is such element in children set.
id()Stage identifier.
indexOfChild()Returns index of a child.
numChildren()A number of stage children.
parent()Returns self.
remove()Removes everything.
removeChild()Removes an element.
removeChildAt()Removes an element by index.
removeChildren()Removes all elements.
swapChildren()Swaps two children.
swapChildrenAt()Swaps two children by id.
Transformations
appendTransformationMatrix()Combines current transformation with another.
getRotationAngle()Returns rotation angle in degrees.
getTransformationMatrix()Returns transformation matrix.
scale()Scales root layer in parent coordinates system. Scaling center is set in the parent system too.
scaleByAnchor()Scales root layer in parent coordinates system. Scaling center is set by root layer anchor.
setTransformationMatrix()Sets transformation matrix.
translate()Moves root layer taking transformation into account.
Miscellaneous
credits()Credits settings
desc()Description attribute for SVG structure.
fullScreen()Fullscreen mode.
isFullScreenAvailable()Whether the context menu available in the browser or not.
maxResizeDelay()Getter for max delay.
title()Title attribute for SVG structure.
visible()Switch flag of stage visibility.

Methods Description

addChild

Adds an element.
Similar to anychart.graphics.vector.Layer#addChild

Params:

NameTypeDescription
elementanychart.graphics.vector.ElementElement.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

addChildAt

Adds an element by index.
Similar to anychart.graphics.vector.Layer#addChildAt

Params:

NameTypeDescription
elementanychart.graphics.vector.ElementElement.
indexnumberChild index.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

appendTransformationMatrix

Combines current transformation with another.
Combination is done by multiplying matrix to the right.
Read more at: anychart.graphics.vector.Element#appendTransformationMatrix.

Params:

NameTypeDescription
m00numberScale X.
m10numberShear Y.
m01numberShear X.
m11numberScale Y.
m02numberTranslate X.
m12numberTranslate Y.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

asyncMode

Getter for the current stage rendering mode.

Returns:

boolean - Returns mode.
See listing
var stage = anychart.graphics.create("container");
var asyncMode = stage.asyncMode();
Setter for the stage rendering mode.

Params:

NameTypeDefaultDescription
asyncboolean
false
Value to set.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining

circle

Invokes anychart.graphics.vector.Circle constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.
Read more at: anychart.graphics.vector.Circle

Params:

NameTypeDescription
cxnumberCenter X, in pixels.
cynumberCenter Y, in pixels.
radiusnumberRadius, in pixels.

Returns:

anychart.graphics.vector.Circle - An instance of the class for method chaining.

clip

Gets clip bounds.
Works only after render() is invoked.
Read more at: anychart.graphics.vector.Element#clip.

Returns:

anychart.graphics.math.Rect - Clipping rectangle.
Clips a stage.
Works only after render() is invoked.
Read more at: anychart.graphics.vector.Element#clip.

Params:

NameTypeDescription
rectanychart.graphics.math.RectClipping rectangle.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

container

Returns DOM element where everything is drawn upon rendering.

Returns:

Element - Returns DOM element of graphics container.
Sets DOM element where everything is drawn upon rendering.

Params:

NameTypeDescription
elementElementContainer DOM element.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

createClip

Creates a clip element using single value.

Params:

NameTypeDescription
rectArray.<number> | anychart.graphics.math.Rect | Object | nullRect or array or object representing bounds.

Returns:

anychart.graphics.vector.Clip - Clip element.
Creates a clip element using several values.

Params:

NameTypeDescription
leftnumberLeft coordinate of bounds.
topnumberTop coordinate.
widthnumberWidth of the rect.
heightnumberHeight of the rect.

Returns:

anychart.graphics.vector.Clip - Clip element.

credits

Getter for stage credits.

Returns:

anychart.core.ui.StageCredits - Credits instance.
Setter for stage credits. Learn more about credits settings.

Params:

NameTypeDescription
settingsObject | boolean | nullCredits settings.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

cross

Draws a cross defined by a circumscribed circle.
Read more at anychart.graphics.vector.primitives#cross

data

Returns stage JSON. Serializes stage and all its object to JSON.

Returns:

Object - JSON data of stage.
Deserialize JSON. Objects are created and rendered to the current stage.
Note: All settings except events and handlers are serialized. JSON object must be conformed with JSON schema (can be found in the project root). No checks are done when we deserialize - JSON schema does this. JSON schema is created in 4-th version of standard JSON schema.

Params:

NameTypeDescription
settingsObjectJSON data to set for stage.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

desc

Getter for the element description value.

Returns:

string | null | undefined - The element description value.
Setter for the element desc value.

Params:

NameTypeDescription
textstring | nullValue to set.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

diagonalCross

Draws a diagonal cross set by it circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#diagonalCross

diamond

Draws a diamond set by it circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#diamond

dispose

Disposes stage.
Removes it from parent layer, nulls links, removes from DOM.

domElement

Returns stage root DOM element.

Returns:

Element - Stage root DOM element.

donut

Draws arc as donut chart element.
Read more at anychart.graphics.vector.primitives#donut

ellipse

Invokes anychart.graphics.vector.Ellipse constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.
Read more at: anychart.graphics.vector.Ellipse

Params:

NameTypeDescription
cxnumberCenter X, in pixels.
cynumberCenter Y, in pixels.
rxnumberX radius, in pixels.
rynumberY radius, in pixels.

Returns:

anychart.graphics.vector.Ellipse - An instance of the class for method chaining.

forEachChild

Applies function to all children.
Similar to anychart.graphics.vector.Layer#forEachChild

Params:

NameTypeDescription
callbackfunction(element:anychart.graphics.vector.Element):voidCallback.
thisObjectThis element.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

fullScreen

Getter for the fullscreen mode.

Returns:

boolean - Full screen state (enabled/disabled).
See listing
var fullScreen = stage.fullScreen();
Setter for the fullscreen mode.

Params:

NameTypeDefaultDescription
enabledboolean
false
Enable/Disable fullscreen mode.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

getBounds

Returns bounds.

Returns:

anychart.graphics.math.Rect - Bounds.

getChildAt

Returns an element by index.
Similar to anychart.graphics.vector.Layer#getChildAt

Params:

NameTypeDescription
indexnumberChild index.

Returns:

anychart.graphics.vector.Element - Element or null.

getContainerElement

Returns stage container element.

Returns:

Element - Stage container element.

getDomWrapper

Returns a DIV wrapper that contains stage and other utilitarian DOM elements.

Returns:

Element - The inner wrapper.

getJpgBase64String

Returns JPG as base64 string.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.
forceTransparentWhitebooleanForce transparent to white or not.

getPdfBase64String

Returns PDF as base64 string.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
paperSizeOrWidthnumber | stringAny paper format like 'a0', 'tabloid', 'b4', etc.
landscapeOrWidthnumber | booleanDefine, is landscape.
xnumberOffset X.
ynumberOffset Y.

getPngBase64String

Returns PNG as base64 string.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.

getRotationAngle

Returns rotation angle in degrees.
Read more at: anychart.graphics.vector.Element#getRotationAngle.

Returns:

number - Rotation angle.

getStage

Returns self.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

getSvgBase64String

Returns SVG as base64 string.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
paperSizeOrWidthstring | numberPaper Size or width.
landscapeOrHeightboolean | stringLandscape or height.

getTransformationMatrix

Returns current transformation matrix: [ {number} m00 Scale X. {number} m10 Shear Y. {number} m01 Shear X. {number} m11 Scale Y. {number} m02 Translate X. {number} m12 Translate Y. ]
Read more at: anychart.graphics.vector.Element#getTransformationMatrix.

Returns:

Array.<number> - Transformation matrix.

getX

Returns X of top left corner.

Returns:

number - X of top left corner.

getY

Returns Y of top left corner.

Returns:

number - Y of top left corner.

hLine

Draws a thick horizontal line set by its circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#hLine

hasChild

Checks if there is such element in children set.
Similar to anychart.graphics.vector.Layer#hasChild

Params:

NameTypeDescription
elementanychart.graphics.vector.ElementElement to check.

Returns:

boolean - Is there such element in stage or not.

hatchFill

Invokes anychart.graphics.vector.HatchFill constructor. Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You have to delete them yourself after you finish using them.
Read more at: anychart.graphics.vector.HatchFill

Params:

NameTypeDescription
typeanychart.graphics.vector.HatchFill.HatchFillTypeType of hatch fill.
colorstringHatch color (You can combine with opacity).
thicknessnumberHatch fill thickness.
sizenumberHatch fill size.

Returns:

anychart.graphics.vector.HatchFill - An instance of the class for method chaining.

height

Getter for the stage height.

Returns:

number - The height of stage.
Setter for a stage height.

Params:

NameTypeDescription
heightstring | numberHeight of stage.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

html

Invokes anychart.graphics.vector.Text and applies anychart.graphics.vector.Text#htmlText method to parse HTML.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.

Params:

NameTypeDescription
xnumberX-coordinate (Left) of left top corner of text bounds.
ynumberY-coordinate (Top) of left top corner of text bounds.
textstringText.
styleanychart.graphics.vector.TextStyleText style. Read more at anychart.graphics.vector.Text#style.

Returns:

anychart.graphics.vector.Text - An instance of the class for method chaining.

id

Getter for the stage identifier. If it was not set, than it will be generated.

Returns:

string - Returns element identifier.
Setter for a stage identifier. Instantly applied to the DOM.

Params:

NameTypeDescription
idstringCustom identifier.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

image

Invokes anychart.graphics.vector.Image constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.

Params:

NameTypeDescription
srcstringIRI (Internationalized Resource Identifiers) for image source.
xnumberX coordinate of left-top corner image.
ynumberY coordinate of left-top corner image.
widthnumberWidth of image bounds.
heightnumberHeight of image bounds.

Returns:

anychart.graphics.vector.Image - Image object instance.

indexOfChild

Returns index of a child.
Similar to anychart.graphics.vector.Layer#indexOfChild

Params:

NameTypeDescription
elementanychart.graphics.vector.ElementElement.

Returns:

number - Index or -1.

isFullScreenAvailable

Whether the context menu available in the browser or not.

Returns:

boolean - isFullScreenAvailable state.

isRendering

Indicates if stage is in rendering process.

Returns:

boolean - State of rendering process.

isSuspended

Returns rendering state (true - suspended, false - instant).

Returns:

boolean - Rendering state.

layer

Invokes anychart.graphics.vector.Layer constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.

Returns:

anychart.graphics.vector.Layer - An instance of the class for method chaining.

listen

Adds an event listener to a stage.

Params:

NameTypeDefaultDescription
typestring | anychart.graphics.vector.Stage.EventType
The event type name.
listenerfunction(e:Object):boolean|undefined
A function to execute each time the event is triggered.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing
listenerScopeObject
'Window'
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

listenOnce

Adds an event listener that is removed automatically after the listener fired once.

Params:

NameTypeDefaultDescription
typestring | anychart.graphics.vector.Stage.EventType
The event type name.
listenerfunction(e:Object):boolean|undefined
A function to execute each time the event is triggered.
useCaptureboolean
false
Whether to fire in capture phase. Learn more about capturing
listenerScopeObject
'Window'
Object in whose scope to call the listener.

Returns:

Object - Unique key for the listener.

maxResizeDelay

Getter for max delay.

Returns:

number - Max delay value.
See listing
var delay = stage.maxResizeDelay();
Setter for max delay.

Params:

NameTypeDescription
delaynumberMax delay value

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

numChildren

A number of stage children.
Similar to anychart.graphics.vector.Layer#numChildren

Returns:

number - Number of stage children.

parent

Returns self.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

path

Invokes anychart.graphics.vector.Path constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.
Read more at Path: anychart.graphics.vector.Path

Returns:

anychart.graphics.vector.Path - An instance of the class for method chaining.

pattern

Invokes anychart.graphics.vector.PatternFill.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.
Read more at: anychart.graphics.vector.PatternFill

Params:

NameTypeDescription
boundsanychart.graphics.math.RectBounds of pattern. Defines size and offset of pattern.

Returns:

anychart.graphics.vector.PatternFill - An instance of the class for method chaining.

pie

Draws arc as pie chart element.
Read more at anychart.graphics.vector.primitives#pie

print

Print stage.

Params:

NameTypeDescription
paperSizeOrWidthstring | numberPaper Size or width.
landscapeOrHeightboolean | stringLandscape or height.

rect

Invokes anychart.graphics.vector.Rect constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.

Params:

NameTypeDescription
xnumberX (Left) coordinate of top-left corner.
ynumberY (Top) coordinate of top-left corner.
widthnumberWidth.
heightnumberHeight.

Returns:

anychart.graphics.vector.Rect - An instance of the class for method chaining.

remove

Removes everything.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

removeChild

Removes an element.
Similar to anychart.graphics.vector.Layer#removeChild

Params:

NameTypeDescription
elementanychart.graphics.vector.ElementElement.

Returns:

anychart.graphics.vector.Element - Removed element.

removeChildAt

Removes an element by index.
Similar to anychart.graphics.vector.Layer#removeChildAt

Params:

NameTypeDescription
indexnumberIndex.

Returns:

anychart.graphics.vector.Element - Removed element.

removeChildren

Removes all elements.
Similar to anychart.graphics.vector.Layer#removeChildren

Returns:

Array.<anychart.graphics.vector.Element> - Array of removed elements.

resize

Stage resize. Anything drawn on stage must fit in it. So any part that doesn't fit will be clipped.

Params:

NameTypeDescription
widthnumber | stringWidth.
heightnumber | stringHeight.

resume

Removes suspend state and applies all changes in sync (if any).
Read more at anychart.graphics.vector.Stage#suspend.

Params:

NameTypeDefaultDescription
forceboolean
false
If set to true - this parameter resets the stack of suspends and calls rendering immediately.

rotate

Rotates root layer.
Read more at: anychart.graphics.vector.Element#rotate.

Params:

NameTypeDescription
degreesnumberRotation angle.
cxnumberRotaion X.
cynumberRotaion Y.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

rotateByAnchor

Rotates root layer around an anchor.
Read more at: anychart.graphics.vector.Element#rotateByAnchor.

Params:

NameTypeDescription
degreesnumberRotation angle.
anchoranychart.graphics.vector.Anchor | stringRotation anchor.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

roundedInnerRect

Draws rectangle with inner rounded corners.
Read more at anychart.graphics.vector.primitives#roundedInnerRect

roundedRect

Draws rectangle with rounded corners.
Read more at anychart.graphics.vector.primitives#roundedRect

saveAsJpg

Saves the stage as JPG Image.
For export to image JPG use anychart.graphics#server.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.
forceTransparentWhitebooleanForce transparent to white or not.
filenamestringFile name to save.

saveAsPdf

Saves the stage as PDF Document.
For export to PDF file use anychart.graphics#server.

Params:

NameTypeDescription
paperSizestringAny paper format like 'a0', 'tabloid', 'b4', etc.
landscapebooleanDefine, is landscape.
xnumberOffset X.
ynumberOffset Y.
filenamestringFile name to save.

saveAsPng

Saves the stage as PNG Image.
For export to image PNG use anychart.graphics#server.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.
filenamestringFile name to save.

saveAsSvg

Saves the stage as SVG Image.
For export to SVG use anychart.graphics#server.

Params:

NameTypeDescription
paperSizestringPaper Size.
landscapebooleanLandscape.
filenamestringFile name to save.
Saves the stage as SVG Image using width and height.
For export to SVG use anychart.graphics#server.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.

scale

Scales root layer in parent coordinates system. Scaling center is set in the parent system too.
Read more at: anychart.graphics.vector.Element#scale.

Params:

NameTypeDescription
sxnumberScale X.
synumberScale Y.
cxnumberScale center X.
cynumberScale center Y.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

scaleByAnchor

Scales root layer in parent coordinates system. Scaling center is set by root layer anchor.
Read more at: anychart.graphics.vector.Element#scaleByAnchor.

Params:

NameTypeDescription
sxnumberScale X.
synumberScale Y.
anchoranychart.graphics.vector.Anchor | stringScaling center anchor.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

setPosition

Sets top left corner coordinates of root layer (with transformation,in parent coordinate system).
Read more at: anychart.graphics.vector.Element#setPosition.

Params:

NameTypeDescription
xnumberX of top left corner.
ynumberY of top left corner.

Returns:

anychart.graphics.vector.Stage - Returns self for chaining.

setRotation

Rotates root layer around a point.
Read more at: anychart.graphics.vector.Element#setRotation.

Params:

NameTypeDescription
degreesnumberRotation angle.
cxnumberRotaion X.
cynumberRotaion Y.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

setRotationByAnchor

Rotates root layer around an anchor.
Read more at: anychart.graphics.vector.Element#setRotationByAnchor.

Params:

NameTypeDescription
degreesnumberRotation angle.
anchoranychart.graphics.vector.Anchor | stringRotation anchor.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

setTransformationMatrix

Sets transformation matrix.
Read more at: anychart.graphics.vector.Element#setTransformationMatrix.

Params:

NameTypeDescription
m00numberScale X.
m10numberShear Y.
m01numberShear X.
m11numberScale Y.
m02numberTranslate X.
m12numberTranslate Y.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

shareAsJpg

Share a stage as a JPG and return link to shared image.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
asBase64booleanShare as base64 file.
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.
forceTransparentWhitebooleanForce transparent to white or not.
filenamestringFile name to save.

shareAsPdf

Share a stage as a PDF and return link to shared image.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
asBase64booleanShare as base64 file.
paperSizeOrWidthnumber | stringAny paper format like 'a0', 'tabloid', 'b4', etc.
landscapeOrWidthnumber | booleanDefine, is landscape.
xnumberOffset X.
ynumberOffset Y.
filenamestringFile name to save.

shareAsPng

Shares a stage as a PNG file and returns a link to the shared image.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
asBase64booleanShare as base64 file.
widthnumberImage width.
heightnumberImage height.
qualitynumberImage quality in ratio 0-1.
filenamestringFile name to save.

shareAsSvg

Share a stage as a SVG and return link to shared image.

Params:

NameTypeDescription
onSuccessfunction(response:string)Function that is called when sharing is complete.
onErrorfunction(response:string)Function that is called if sharing fails.
asBase64booleanShare as base64 file.
paperSizeOrWidthstring | numberPaper Size or width.
landscapeOrHeightboolean | stringLandscape or height.
filenamestringFile name to save.

star

Draws multi-pointed star.
Read more at anychart.graphics.vector.primitives#star

star10

Draws ten-pointed star.
Read more at anychart.graphics.vector.primitives#star10

star4

Draws four-pointed star.
Read more at anychart.graphics.vector.primitives#star4

star5

Draws five-pointed star.
Read more at anychart.graphics.vector.primitives#star5

star6

Draws six-pointed star.
Read more at anychart.graphics.vector.primitives#star6

star7

Draws seven-pointed star.
Read more at anychart.graphics.vector.primitives#star7

suspend

Suspends rendering (changes instant to suspended).

swapChildren

Swaps two children.
Similar to anychart.graphics.vector.Layer#swapChildren

Params:

NameTypeDescription
element1anychart.graphics.vector.ElementFirst child.
element2anychart.graphics.vector.ElementSecond child.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

swapChildrenAt

Swaps two children by id.
Similar to anychart.graphics.vector.Layer#swapChildrenAt

Params:

NameTypeDescription
index1numberFirst child or id.
index2numberSecond child or id.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

text

Invokes anychart.graphics.vector.Text constructor.
Note:
anychart.graphics.vector.Stage doesn't delete objects you create. You must delete them yourself after you finish using them.

Params:

NameTypeDescription
xnumberX-coordinate (Left) of left top corner of text bounds.
ynumberY-coordinate (Top) of left top corner of text bounds.
textstringText.
styleanychart.graphics.vector.TextStyleText style. Read more at anychart.graphics.vector.Text#style.

Returns:

anychart.graphics.vector.Text - An instance of the class for method chaining.

title

Getter for the element title value.

Returns:

string | null | undefined - The element title value.
Setter for the element title value.

Params:

NameTypeDescription
textstring | nullTitle text to set.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

toSvg

Returns SVG string if type of content is SVG with parameters otherwise returns empty string.

Params:

NameTypeDescription
paperSizestringPaper Size.
landscapebooleanLandscape.

Returns:

string - SVG content or empty string.
Returns SVG string if type of content is SVG with determined the width and height otherwise returns empty string.

Params:

NameTypeDescription
widthnumberImage width.
heightnumberImage height.

Returns:

string - SVG content or empty string.

translate

Moves root layer taking transformation into account.
Movement happens in root layer coordinates.
Read more at: anychart.graphics.vector.Element#translate.

Params:

NameTypeDescription
txnumberX offset.
tynumberY offset.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

triangleDown

Draws a triangle heading downwards set by it circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#triangleDown

triangleLeft

Draws a triangle heading leftwards set by it circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#triangleLeft

triangleRight

Draws a triangle heading rightwards set by it circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#triangleRight

triangleUp

Draws a triangle heading upwards set by its circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#triangleUp

truncatedRect

Draws rectangle with truncated corners.
Read more at anychart.graphics.vector.primitives#truncatedRect

unlisten

Params:

NameTypeDefaultDescription
typestring | anychart.graphics.vector.Stage.EventType
The event type name.
listenerfunction(e:Object):boolean|undefined
A function to execute each time the event is triggered.
useCaptureboolean
false
Whether to fire in capture phase. capturing
listenerScopeObject
'Window'
Object in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Params:

NameTypeDescription
keyObjectThe key returned by anychart.graphics.vector.Stage#listen or anychart.graphics.vector.Stage#listenOnce.

Returns:

boolean - Whether any listener was removed.

vLine

Draws a thick vertical line set by its circumscribed circle center and radius.
Read more at anychart.graphics.vector.primitives#vLine

visible

Returns the current stage visibility.

Returns:

boolean - Visibility.
Shows or hides a stage.

Params:

NameTypeDefaultDescription
isVisibleboolean
true
Visibility.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.

width

Getter for the stage width.

Returns:

number - Returns width of stage.
Setter for a stage width.

Params:

NameTypeDescription
widthstring | numberWidth of stage.

Returns:

anychart.graphics.vector.Stage - Self instance for method chaining.