Type module
Sources
Items from Math can be imported/included and used via following ways.
/** * -------------------------------------------------------- * Import via main package: core.ts * Access items like: am4core.math.myVariable * am4core.math.myFunction() * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4"; /** * -------------------------------------------------------- * Import via: Math.ts * Access items like: $math.myVariable * $math.myFunction() * -------------------------------------------------------- */ import * as $math from "@amcharts/amcharts4/Math";
/** * -------------------------------------------------------- * Include via "core.js" * Access items like: am4core.math.myVariable * am4core.math.myFunction() * -------------------------------------------------------- */
Variables
|
RADIANS # |
Type Default |
|---|---|
|
HALFPI # |
Type Default |
|
DEGREES # |
Type Default |
Functions
|
ceil( value: ) |
Returns Ceils the numeric value to whole number or specific precision of set. |
|---|---|
|
closest( values: ) |
Returns Returns the closest value from the array of values to the reference value. |
|
cos( value: ) |
Returns Returns cosine of a number. |
|
fitToRange( value: ) |
Returns Adjust numeric value so it fits to specific value range. |
|
getAngle( point1: ) |
Returns Calculates angle of the vector based on two or one point. |
|
getArcPoint( radius: ) |
Returns { x: Returns point on arc |
|
getBBox( points: ) |
Returns Converts an array of points into a bounding box rectangle. Array can contain any number of points. |
|
getCenterShift( center: ) |
Returns Returns the shift in coordinates of the center when item is rotated, moved and scaled at the same time. |
|
getCommonRectangle( rectangles: ) |
Returns Returns a |
|
getCubicCurveDistance( point1: ) |
Returns Returns approximate pixel "distance" between two points of cubic curveIf second point is not specified, distance from {x:0, y:0} point is calculated. |
|
getDistance( point1: ) |
Returns Returns pixel "distance" between two points. If second point is not specified, distance from {x:0, y:0} point is calculated. |
|
getHorizontalDistance( point1: ) |
Returns Returns pixel "horizontal distance" between two points. If second point is not specified, distance from {x:0, y:0} point is calculated. |
|
getLineIntersection( pointA1: ) |
Returns |
|
getMidPoint( point1: ) |
Returns Returns an exact mid point between two points. |
|
getRotation( point1: ) |
Returns Returns difference in angles between starting and ending position of two vectors. |
|
getScale( point1: ) |
Returns Returns scale based on original and end position of the two points. |
|
getVerticalDistance( point1: ) |
Returns Returns pixel "vertical distance" between two points. If second point is not specified, distance from {x:0, y:0} point is calculated. |
|
intersect( ) |
Returns Checks whether two ranges of values intersect. |
|
intersection( ) |
Returns Returns an intersection range between two ranges of values. |
|
invertRange( range: ) |
Returns Inverts the range of values. |
|
isInRectangle( point: ) |
Returns Returns true if a point is within rectangle |
|
sin( value: ) |
Returns Returns sine of a number. |
|
stretch( t: ) |
Returns Stretches |
|
tan( value: ) |
Returns Returns tan of a number. |
|
toNumberRange( value: ) |
Returns Converts any value and fits it into a specific value range. |