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

namespace anychart.graphics.vector.primitives Improve this Doc

Namespace for anychart.graphics.vector.primitives. 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 rectangle with rounded corners.
roundedRect()Draws a rectangle 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.
triangleLeft()Draws a triangle heading leftwards set by it's circumscribed circle's center and radius.
triangleRight()Draws a triangle heading rightwards 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 rectangle 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:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

diagonalCross

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

diamond

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of diamond circumscribed circle's center.
centerY number Y coordinate of diamond circumscribed circle's center.
outerRadius number Diamond circumscribed circle's radius.

Returns:

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

Try it:

donut

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
cx number Center x.
cy number Center y.
outerR number Outer radius.
innerR number Inner radius.
start number Start angle in degrees.
sweep number Sweep angle in degrees.

Returns:

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

Try it:

hLine

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

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:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
cx number Center x.
cy number Center y.
r number Radius.
start number Start angle in degrees.
sweep number Sweep angle in degrees.

Returns:

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

Try it:

roundedInnerRect

Draws a rectangle with rounded corners.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path to create a path or a Path to append a rect. Path is not cleared before rect drawing, so you need to clear it manually.
rect anychart.graphics.math.Rect Rect which corners will be truncated.
var_args number Set 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 the class for method chaining.

Try it:

roundedRect

Draws a rectangle with rounded inner corners.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path to create a path or a Path to append a rect. Path is not cleared before rect drawing, so you need to clear it manually.
rect anychart.graphics.math.Rect Rect which corners will be truncated.
var_args number Set 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 the class for method chaining.

Try it:

star

Draws multi-pointed star.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.truncatedRect
outerRadius number Outer star radius.
innerRadius number Inner star radius.
numberOfSpikes number Number of star spikes. Should be 2 or higher.
startDegrees number Angle of the first spike in degrees.
curvature number Curvature 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 the class for method chaining.

Try it:

star10

Draws a 10-spiked star.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

star4

Draws a 4-spiked star.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

star5

Draws a 5-spiked star.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

star6

Draws a 6-spiked star.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

star7

Draws a 7-spiked star.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it:

triangleDown

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of triangle circumscribed circle's center.
centerY number Y coordinate of triangle circumscribed circle's center.
outerRadius number Triangle circumscribed circle's radius.

Returns:

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

Try it:

triangleLeft

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of triangle circumscribed circle's center.
centerY number Y coordinate of triangle circumscribed circle's center.
outerRadius number Triangle circumscribed circle's radius.

Returns:

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

Try it:

triangleRight

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of triangle circumscribed circle's center.
centerY number Y coordinate of triangle circumscribed circle's center.
outerRadius number Triangle circumscribed circle's radius.

Returns:

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

Try it:

triangleUp

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of triangle circumscribed circle's center.
centerY number Y coordinate of triangle circumscribed circle's center.
outerRadius number Triangle circumscribed circle's radius.

Returns:

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

Try it:

truncatedRect

Draws a rectangle with truncated corners.

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path to create a path or a Path to append a rect. Path is not cleared before rect drawing, so you need to clear it manually.
rect anychart.graphics.math.Rect Rect which corners will be truncated.
var_args number Set 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 of rectangle.

Returns:

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

Try it:

vLine

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

Params:

Name Type Description
stageOrPath anychart.graphics.vector.Stage | anychart.graphics.vector.Path Stage 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.
centerX number X coordinate of star center.
centerY number Y coordinate of star center.
outerRadius number Outer star radius.

Returns:

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

Try it: