Area

extends Path

The Area class represents an enclosed area mark that is used in visualizations such as the area chart and the violin plot. You cannot create an Area object directly, instead, you need to use the densify operation to transform a Rect to an Area. Here is an explanation of the densify operation. The figure below shows how Area objects are created from a Rect object through the densify operation.

Area

Properties

propertyexplanationtypedefault value
baselinethe anchor used to evenly distribute the width or height of the areaString
firstVertexPair the first pair of the vertices (highlighted in red in the figure above)Array of Vertex
height the height of the areaNumber
left the x coordinate of the first vertexNumber
orientationthe orientation of the areaString
top the y coordinate of the first vertexNumber
width the width of the areaNumber

Properties inherited from Path

propertyexplanationtypedefault value
curveModehow the segments are drawnString
firstSegment returns the first segment of the pathSegment
firstVertex returns the first vertex of the pathVertex
segments the segments on the pathArray
vertices the vertices along the pathArray
vxFillColorthe fill color of the vertices on this pathColor“#555555”
vxHeightthe height of the vertices on this pathNumber0
vxOpacitythe opacity of the vertices on this pathNumber1
vxRadiusthe radius of the vertices on this path if the shape is “circle”Number0
vxShapethe shape of the vertices on this path
possible values: “rect”, “circle”
Stringundefined
vxStrokeColorthe stroke color of the vertices on this pathColor“#aaaaaa”
vxStrokeWidththe stroke width of the vertices on this path in pixelsNumber0
vxWidththe width of the vertices on this pathNumber0
x the x coordinate of the center of the path boundsNumber
y the y coordinate of the center of the path boundsNumber

Properties inherited from Mark

propertyexplanationtypedefault value
bounds the bounding rectangle of the markRectangle
dataScopethe data scope of the markDataScopeundefined
fillColorthe fill color of the markColor“none”
id the unique id of the markString
opacitythe opacity value of the mark (between 0 and 1)Number1
strokeColorthe stroke color of the markColor“#ccc”
strokeDashthe dashes and gaps for the mark strokeString“none”
strokeWidththe stroke width of the mark in pixelsNumber1
type the type of the markString“area”
visibilitywhether the mark is visible (“visible” or “hidden”)String“visible”

Methods inherited from Path

methodexplanationreturn type
getSVGPathData()returns a string to be used as the d parameter in an SVG path elementString
resize(wd, ht, xRef, yRef)change the width and height of the area
wd (Number): width
ht (Number): height
xRef (String, optional): horizontal reference point
yRef (String, optional): vertical reference point
void