Polygon3D
12 Sep 20259 minutes to read
Represents a 3D polygon in a chart.
Methods
applyXLight
Applies a lightening effect to the given color by reducing its red, green and blue components.
| Parameter | Type | Description |
|---|---|---|
| color | string |
The input color in hexadecimal format. |
| chart | Chart3D |
The three-dimensional chart associated with the color. |
Returns string
applyZLight
Applies a lightening effect to the given color by reducing its red, green and blue components with a focus on the Z-axis.
| Parameter | Type | Description |
|---|---|---|
| color | string |
The input color in hexadecimal format. |
| chart | Chart3D |
The three-dimensional chart associated with the color. |
Returns string
calculateNormal
Calculates the normal vector for a 3D polygon based on the provided points.
| Parameter | Type | Description |
|---|---|---|
| args | any[] |
Variable number of vector3d arguments representing points of the polygon. |
Returns void
createBox
Creates a 3D box based on the given vectors, chart, and styling parameters.
Returns Chart3DPolygon[]
createCylinder
Creates a 3D cylinder based on the given vectors, chart, and styling parameters.
| Parameter | Type | Description |
|---|---|---|
| v1 | Chart3DVector |
The start vector of the cylinder. |
| v2 | Chart3DVector |
The end vector of the cylinder. |
| chart | Chart3D |
The 3D chart to which the cylinder belongs. |
| index | number |
The index of the cylinder. |
| type | string |
The type of the cylinder. |
| stroke | string |
The stroke color of the cylinder. |
| fill | string |
The fill color of the cylinder. |
| strokeThickness | number |
The thickness of the stroke. |
| opacity | number |
The opacity of the cylinder. |
| name | string |
The name of the cylinder. |
| parent | Element |
The parent element of the cylinder. |
Returns Chart3DPolygon[]
createLine
Creates a 3D line.
| Parameter | Type | Description |
|---|---|---|
| line | Chart3DTickElement |
The tick elements associated with the line. |
| x1 | number |
The x-coordinate of the starting point. |
| y1 | number |
The y-coordinate of the starting point. |
| x2 | number |
The x-coordinate of the ending point. |
| y2 | number |
The y-coordinate of the ending point. |
| depth | number |
The depth or z-coordinate of the line in 3D space. |
Returns Chart3DPolygon
createTextElement
A method for creating text element.
| Parameter | Type | Description |
|---|---|---|
| position | Chart3DVector |
text position. |
| element | Chart3DLabelElement |
text element. |
| xLength | number |
text element x value. |
| yLength | number |
text element y value. |
Returns Chart3DPolygon
draw
Draws a three-dimensional polygon on the specified chart.
| Parameter | Type | Description |
|---|---|---|
| panel | Chart3DPolygon |
The polygon to be drawn. |
| chart | Chart3D |
The three-dimensional chart on which the polygon is to be drawn. |
Returns void
drawLine
Draws a template on the specified 3D chart panel.
| Parameter | Type | Description |
|---|---|---|
| panel | Chart3DPolygon |
The 3D polygon representing the panel on which the template will be drawn. |
| chart | Chart3D |
The 3D chart to which the panel belongs. |
Returns void
drawTemplate
Draws text on the specified 3D chart panel.
| Parameter | Type | Description |
|---|---|---|
| panel | Chart3DPolygon |
The 3D polygon representing the panel on which the text will be drawn. |
| chart | Chart3D |
The 3D chart to which the panel belongs. |
Returns void
drawText
Draws a data label symbol for a specific data point in a three-dimensional series.
| Parameter | Type | Description |
|---|---|---|
| panel | Chart3DPolygon |
The 3D polygon representing the panel on which the text will be drawn. |
| chart | Chart3D |
The 3D chart to which the panel belongs. |
Returns void
line3D
Creates a 3D line polygon based on the given tick elements and points.
| Parameter | Type | Description |
|---|---|---|
| element | Chart3DTickElement |
The tick elements associated with the line. |
| points | Chart3DVector[] |
The array of 3D vector points defining the line in 3D space. |
Returns Chart3DPolygon
polygon3D
Creates a 3D polygon.
Returns Chart3DPolygon
test
Tests whether the calculated normal vector is valid.
Returns boolean
text3D
Creates a 3D text polygon based on the given label element and points.
| Parameter | Type | Description |
|---|---|---|
| element | Chart3DLabelElement |
The label element associated with the text. |
| points | Chart3DVector[] |
The array of 3D vector points defining the position of the text in 3D space. |
Returns Chart3DPolygon
transform
Transforms the vector points of the specified polygon using the provided matrix.
| Parameter | Type | Description |
|---|---|---|
| matrix | number[][] |
The transformation matrix. |
| polygon | Chart3DPolygon |
The polygon to transform. |
Returns void