Top
You are looking at an outdated 7.0.0 version of this document. Switch to the 8.0.1 version to see the up to date information.

namespace anychart.graphics Improve this Doc

A namespace of all functions, objects, and classes provided by AnyChart Stage.

Functions Overview

circle()Creates an instance of the anychart.graphics.vector.Circle class
create()Creates and returns a Stage object providing instruments for cross-browser drawing with a commnon interface
ellipse()Creates an instance of the anychart.graphics.vector.Ellipse class.
hatchFill()Creates an instance of theanychart.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 theanychart.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
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
validate()Checks the graphics config for conform to graphics JSON scheme.

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:

Name Type Description
cx number The X-coordinate of the center of the circle in pixels.
cy number The Y-coordinate of the center of the circle in pixels.
radius number The radius of the circle in pixels.

create

Creates and returns a Stage object providing instruments for cross-browser drawing with a commnon interface for all supported technologies.

Params:

Name Type Description
container Element | string A container where all graphics will be drawn. It can be defined later, for example while rendering.
width string | number The width of a Stage object in pixels.
height string | number 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:

Name Type Description
cx number The X-coordinate of the center of the ellipse in pixels.
cy number The Y-coordinate of the center of the ellipse in pixels.
rx number The X-axis radius of the ellipse in pixels.
ry number The Y-axis radius of the ellipse in pixels.

hatchFill

Creates an instance of theanychart.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:

Name Type Description
type anychart.graphics.vector.HatchFill.HatchFillType The type of the hatch fill.
color string The color of the the hatch combined with opacity.
thickness number The thickness of the hatch fill.
size number The size of the hatch fill.

Returns:

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

Try it:

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:

Name Type Description
src string The IRI (Internationalized Resource Identifier) of the image source.
x number The X-coordinate of the left-top corner of the image.
y number The Y-coordinate of the left-top corner of the image.
width number The width of the image bounds.
height number The height of the image bounds.

Returns:

anychart.graphics.vector.Image - The instance of the anychart.graphics.vector.Image class.

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 - The instance of theanychart.graphics.vector.Layer class.

Try it:

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 - The instance of the anychart.graphics.vector.Path class.

Try it:

patternFill

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

Params:

Name Type Description
bounds anychart.graphics.math.Rect The bounds of the pattern. Defines the size and offset of the pattern.

Returns:

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

Try it:

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:

Name Type Description
x number The X-coordinate (left) of the top-left corner of the rectangle.
y number The Y-coordinate (left) of the top-left corner of the rectangle.
width number The width of the rectangle.
height number The height of the rectangel.

Returns:

anychart.graphics.vector.Rect - The instance of 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.

Params:

Name Type Description
address string Export 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 theanychart.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:

Name Type Description
x number The X-coordinate (left) of the top-left corner of the text bounds.
y number The Y-coordinate (top) of the top-left corner of the text bounds.
text string The text to display.
style anychart.graphics.vector.TextStyle Text style. See more: anychart.graphics.vector.Text#style.

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.

validate

Checks the graphics config for conform to graphics JSON scheme.

Params:

Name Type Description
data Object JSON config graphics. JSON should be conform to the graphics JSON schema.
callback function Callback function. First parameter is a validation result.