AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated v7 version of this document. Switch to the v8 version to see the up to date information.

namespace anychart.graphics Improve this Doc

Drawing core namespace.

Functions Overview

circle()Creates an instance of the anychart.graphics.vector.Circle class
clip()Creates an instance of the anychart.graphics.vector.Clip class.
create()Creates and returns a Stage object providing instruments for cross-browser drawing with a common interface
ellipse()Creates an instance of the anychart.graphics.vector.Ellipse class.
hatchFill()Creates an instance of the anychart.graphics.vector.HatchFill class.
In case a fill with such parameters does not
image()Creates an instance of the anychart.graphics.vector.Image class.
layer()Creates an instance of the anychart.graphics.vector.Layer class.
path()Creates an instance of the anychart.graphics.vector.Path class.
patternFill()Creates an instance of the anychart.graphics.vector.PatternFill class.
rect()Creates an instance ot the anychart.graphics.vector.Rect class.
server()Sets and returns an address export server script, which is used to export to an image or PDF.
text()Creates, depending on the technology used, an instance of the anychart.graphics.vector.Text
type()Returns the stage type recommended for the current browser (identified by a name and version). Which is selected from
updateReferences()Update all paths to svg defs.
useAbsoluteReferences()Whether to use absolute path to svg defs.

Enums Overview

anychart.graphics.StageTypeStage types supported by AnyChart Data Visualization Toolkit.

Functions Description

circle

Creates an instance of the anychart.graphics.vector.Circle class
To learn more about working with circles, see: anychart.graphics.vector.Circle
Important: When an element is created this way, a parent element is not assigned to it automatically, so it is necessary to set the parent element manually.

Params:

NameTypeDescription
cxnumberThe X-coordinate of the center of the circle in pixels.
cynumberThe Y-coordinate of the center of the circle in pixels.
radiusnumberThe radius of the circle in pixels.

Returns:

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

clip

Creates an instance of the anychart.graphics.vector.Clip class.

Params:

NameTypeDescription
leftorRectnumber | Array.<number> | anychart.graphics.math.Rect | Object | nullLeft coordinate, rect or array or object representing bounds.
topnumberTop coordinate.
widthnumberWidth of the rect.
heightnumberHeight of the rect.

Returns:

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

create

Creates and returns a Stage object providing instruments for cross-browser drawing with a common interface for all supported technologies.
More at anychart.graphics.StageType

Params:

NameTypeDefaultDescription
containerElement | string
A container where all graphics will be drawn. It can be defined later, for example while rendering.
widthstring | number
"100%"
The width of a Stage object in pixels.
heightstring | number
"100%"
The height of a Stage object in pixels.

Returns:

anychart.graphics.vector.Stage - A Stage object for cross-browser drawing with a common interface for all supported technologies.

ellipse

Creates an instance of the anychart.graphics.vector.Ellipse class.
Important: When an element is created this way, a parent element is not assigned to it automatically, so it is necessary to set the parent element manually.
To learn more about working with ellipses, see: anychart.graphics.vector.Ellipse

Params:

NameTypeDescription
cxnumberThe X-coordinate of the center of the ellipse in pixels.
cynumberThe Y-coordinate of the center of the ellipse in pixels.
rxnumberThe X-axis radius of the ellipse in pixels.
rynumberThe Y-axis radius of the ellipse in pixels.

Returns:

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

hatchFill

Creates an instance of the anychart.graphics.vector.HatchFill class.
In case a fill with such parameters does not exist. If there is already a fill with such parameters, an instance of it is returned.
To learn more about working with hatch fills, see: anychart.graphics.vector.HatchFill

Params:

NameTypeDescription
typeanychart.graphics.vector.HatchFill.HatchFillTypeThe type of the hatch fill.
colorstringThe color of the the hatch combined with opacity.
thicknessnumberThe thickness of the hatch fill.
sizenumberThe size of the hatch fill.

Returns:

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

image

Creates an instance of the anychart.graphics.vector.Image class.
Important: anychart.graphics.vector.Stage does not delete the object you have created. You should remove the object after using it.

Params:

NameTypeDescription
srcstringThe IRI (Internationalized Resource Identifier) of the image source.
xnumberThe X-coordinate of the left-top corner of the image.
ynumberThe Y-coordinate of the left-top corner of the image.
widthnumberThe width of the image bounds.
heightnumberThe height of the image bounds.

Returns:

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

layer

Creates an instance of the anychart.graphics.vector.Layer class.
Important: When an element is created this way, a parent element is not assigned to it automatically, so it is necessary to set the parent element manually.

Returns:

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

path

Creates an instance of the anychart.graphics.vector.Path class.
Important: When an element is created this way, a parent element is not assigned to it automatically, so it is necessary to set the parent element manually.
To learn more about working with Path, see: anychart.graphics.vector.Path

Returns:

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

patternFill

Creates an instance of the anychart.graphics.vector.PatternFill class.
To learn more about working with pattern fills, see: anychart.graphics.vector.PatternFill

Params:

NameTypeDescription
boundsanychart.graphics.math.RectThe bounds of the pattern. Defines the size and offset of the pattern.

Returns:

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

rect

Creates an instance ot the anychart.graphics.vector.Rect class.
Important: When an element is created this way, a parent element is not assigned to it automatically, so it is necessary to set the parent element manually.

Params:

NameTypeDescription
xnumberThe X-coordinate (left) of the top-left corner of the rectangle.
ynumberThe Y-coordinate (left) of the top-left corner of the rectangle.
widthnumberThe width of the rectangle.
heightnumberThe height of the rectangle.

Returns:

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

server

Sets and returns an address export server script, which is used to export to an image or PDF.
See at:
anychart.graphics.vector.Stage#saveAsPdf
anychart.graphics.vector.Stage#saveAsPng
anychart.graphics.vector.Stage#saveAsJpg

Params:

NameTypeDescription
addressstringExport server script URL.

Returns:

string - Export server script URL.

text

Creates, depending on the technology used, an instance of the anychart.graphics.vector.Text or the anychart.graphics.vector.vml.Text class.
Important: When an element is created this way, a parent element is not assigned to it automatically, so it is necessary to set the parent element manually.

Params:

NameTypeDescription
xnumberThe X-coordinate (left) of the top-left corner of the text bounds.
ynumberThe Y-coordinate (top) of the top-left corner of the text bounds.
textstringThe text to display.
styleanychart.graphics.vector.TextStyleText style. See more: anychart.graphics.vector.Text#style.

Returns:

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

type

Returns the stage type recommended for the current browser (identified by a name and version). Which is selected from the supported stage types.

Returns:

anychart.graphics.StageType - A Stage type supported by the current browser.

updateReferences

Update all paths to svg defs.

useAbsoluteReferences

Whether to use absolute path to svg defs.

Params:

NameTypeDescription
valuebooleanValue to set.

Returns:

boolean | undefined - Value.