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

namespace anychart.graphics.vector.primitives Improve this Doc

anychart.graphics.vector.primitives namespace. Contains some predefined functions to simply create common paths.

Functions Overview

cross()Draws a cross set by it's circumscribed circle's center and radius.
diagonalCross()Draws a diagonal cross set by it's circumscribed circle's center and radius.
diamond()Draws a diamond set by it's circumscribed circle's center and radius.
donut()Draws a donut sector with sides. If sweep modulus is larger or equal 360, draws two concentric circles (without sides).
hLine()Draws a thick horizontal line set by it's circumscribed circle's center and radius.
pie()Draws a pie sector with sides (a curvilinear isosceles triangle with center in (cx, cy)).
roundedInnerRect()Draws a rect with rounded corners.
roundedRect()Draws a rect with rounded inner corners.
star()Draws multi-pointed star.
star10()Draws a 10-spiked star.
star4()Draws a 4-spiked star.
star5()Draws a 5-spiked star.
star6()Draws a 6-spiked star.
star7()Draws a 7-spiked star.
triangleDown()Draws a triangle heading downwards set by it's circumscribed circle's center and radius.
triangleUp()Draws a triangle heading upwards set by it's circumscribed circle's center and radius.
truncatedRect()Draws a rect with truncated corners.
vLine()Draws a thick vertical line set by it's circumscribed circle's center and radius.

Functions Description

cross

Draws a cross set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

diagonalCross

Draws a diagonal cross set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

diamond

Draws a diamond set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a diamond. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of diamond circumscribed circle's center.
centerYnumberY coordinate of diamond circumscribed circle's center.
outerRadiusnumberDiamond circumscribed circle's radius.

Returns:

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

donut

Draws a donut sector with sides. If sweep modulus is larger or equal 360, draws two concentric circles (without sides).

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a donut. Path is not cleared before star drawing, so you need to clear it manually.
cxnumberCenter x.
cynumberCenter y.
outerRnumberOuter radius.
innerRnumberInner radius.
startnumberStart angle in degrees.
sweepnumberSweep angle in degrees.

Returns:

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

hLine

Draws a thick horizontal line set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

pie

Draws a pie sector with sides (a curvilinear isosceles triangle with center in (cx, cy)). If sweep modulus is larger or equal 360, draws an ellipse (without sector sides).

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a pie. Path is not cleared before star drawing, so you need to clear it manually.
cxnumberCenter x.
cynumberCenter y.
rnumberRadius.
startnumberStart angle in degrees.
sweepnumberSweep angle in degrees.

Returns:

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

roundedInnerRect

Draws a rect with rounded corners.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.Pathto create a path or a Path to append a rect. Path is not cleared before rect drawing, so you need to clear it manually.
rectanychart.graphics.math.RectRect which corners will be truncated.
var_argsnumberSet of param which define corners radius of rectangle:
ArgsDescription
  1. top-left
  2. top-right
  3. bottom-right
  4. bottom-left
Parameters are set in order, starting from top-left corner clockwise.
  1. top-left
  2. top-right & bottom-left
  3. bottom-right
First parameter is top-left corner, second - top-right and bottom-left, third - bottom-right.
  1. left-top & bottom-right
  2. left-right & bottom-left
First parameter is for left-top and bottom-right, second - left-right and bottom-left
  1. all corners
its value will be applied to each of four rectangle corners.

Returns:

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

roundedRect

Draws a rect with rounded inner corners.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.Pathto create a path or a Path to append a rect. Path is not cleared before rect drawing, so you need to clear it manually.
rectanychart.graphics.math.RectRect which corners will be truncated.
var_argsnumberSet of param which define corners radius of rectangle:
ArgsDescription
  1. top-left
  2. top-right
  3. bottom-right
  4. bottom-left
Parameters are set in order, starting from top-left corner clockwise.
  1. top-left
  2. top-right & bottom-left
  3. bottom-right
First parameter is top-left corner, second - top-right and bottom-left, third - bottom-right.
  1. left-top & bottom-right
  2. left-right & bottom-left
First parameter is for left-top and bottom-right, second - left-right and bottom-left
  1. all corners
its value will be applied to each of four rectangle corners.

Returns:

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

star

Draws multi-pointed star.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.
innerRadiusnumberInner star radius.
numberOfSpikesnumberNumber of star spikes. Should be 2 or higher.
startDegreesnumberAngle of the first spike in degrees.
curvaturenumberCurvature factor. Scopes from -1 to 1, default is 0. 0 Means that spikes will be drawn as lines, positive values make spikes thicker and negative make spikes thinner.

Returns:

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

star10

Draws a 10-spiked star.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

star4

Draws a 4-spiked star.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

star5

Draws a 5-spiked star.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

star6

Draws a 6-spiked star.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

star7

Draws a 7-spiked star.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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

triangleDown

Draws a triangle heading downwards set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a triangle. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of triangle circumscribed circle's center.
centerYnumberY coordinate of triangle circumscribed circle's center.
outerRadiusnumberTriangle circumscribed circle's radius.

Returns:

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

triangleUp

Draws a triangle heading upwards set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a triangle. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of triangle circumscribed circle's center.
centerYnumberY coordinate of triangle circumscribed circle's center.
outerRadiusnumberTriangle circumscribed circle's radius.

Returns:

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

truncatedRect

Draws a rect with truncated corners.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.Pathto create a path or a Path to append a rect. Path is not cleared before rect drawing, so you need to clear it manually.
rectanychart.graphics.math.RectRect which corners will be truncated.
var_argsnumberSet of param which define corners radius of rectangle.
ArgsDescription
  1. top-left
  2. top-right
  3. bottom-right
  4. bottom-left
Parameters are set in order, starting with top-left corner and clockwise.
  1. top-left
  2. top-right & bottom-left
  3. bottom-right
First parameter is top-left corner, second - top-right and bottom-left, third - bottom-right.
  1. left-top & bottom-right
  2. left-right & bottom-left
First parameter is for left-top and bottom-right, second - for left-right abd bottom-left
  1. all corners
its value will be applied to each of four corners pf rectangle.

Returns:

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

vLine

Draws a thick vertical line set by it's circumscribed circle's center and radius.

Params:

NameTypeDescription
stageOrPathanychart.graphics.vector.Stage | anychart.graphics.vector.PathStage to create a path or a Path to append a star. Path is not cleared before star drawing, so you need to clear it manually.
centerXnumberX coordinate of star center.
centerYnumberY coordinate of star center.
outerRadiusnumberOuter star radius.

Returns:

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