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.StageType | Stage 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.
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. |
Returns:
anychart.graphics.vector.Circle - An instance of the class for method chaining.Try it:
clip
Creates an instance of the anychart.graphics.vector.Clip class.
Params:
Name | Type | Description |
---|---|---|
leftorRect | number | Array.<number> | anychart.graphics.math.Rect | Object | null | Left coordinate, rect or array or object representing bounds. |
top | number | Top coordinate. |
width | number | Width of the rect. |
height | number | Height of the rect. |
Returns:
anychart.graphics.vector.Clip - An instance of the class for method chaining.Try it:
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
More at anychart.graphics.StageType
Params:
Name | Type | Default | Description |
---|---|---|---|
container | Element | string | A container where all graphics will be drawn. It can be defined later, for example while rendering. | |
width | string | number | "100%" | The width of a Stage object in pixels. |
height | string | 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.Try it:
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
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. |
Returns:
anychart.graphics.vector.Ellipse - An instance of the class for method chaining.Try it:
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
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 - An instance of the 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.
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 - An instance of the class for method chaining.Try it:
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.
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.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
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.Try it:
patternFill
Creates an instance of the anychart.graphics.vector.PatternFill class.
To learn more about working with pattern fills, see: anychart.graphics.vector.PatternFill
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 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.
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 rectangle. |
Returns:
anychart.graphics.vector.Rect - An instance of the class for method chaining.Try it:
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
See at:
anychart.graphics.vector.Stage#saveAsPdf
anychart.graphics.vector.Stage#saveAsPng
anychart.graphics.vector.Stage#saveAsJpg
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 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.
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. |
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.
Detailed description
Use updateReferences() method if you specify useAbsoluteReferences() method after the all drawn elements
and after tag base. Also use to work with a dynamic URL change. Example, window.history.push. This method doesn't let to disappear reference after URL change.
Affected: "fill", "stroke", "clip-path".
Try it:
useAbsoluteReferences
Whether to use absolute path to svg defs.
Detailed description
Specify useAbsoluteReferences() method before the using of all drawing functions.
If you specify useAbsoluteReferences() method after all the drawing functions that use updateReferences() method.
Possible values:
Possible values:
- true - uses absolute paths. For example: url(https://anychart.com/chart.html?query=param##ac_clip_1).
- false - uses relative paths. For example: url(##ac_clip_1).
- null - auto detects paths (uses absolute paths, if
tag is exists).
Params:
Name | Type | Description |
---|---|---|
value | boolean | Value to set. |
Returns:
boolean | undefined - Value.Try it: