Type module
Sources
Items from Utils can be imported/included and used via following ways.
/** * -------------------------------------------------------- * Import via main package: core.ts * Access items like: am4core.utils.myVariable * am4core.utils.myFunction() * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4"; /** * -------------------------------------------------------- * Import via: Utils.ts * Access items like: $utils.myVariable * $utils.myFunction() * -------------------------------------------------------- */ import * as $utils from "@amcharts/amcharts4/Utils";
/** * -------------------------------------------------------- * Include via "core.js" * Access items like: am4core.utils.myVariable * am4core.utils.myFunction() * -------------------------------------------------------- */
Variables
urlRegexp # |
Type Default |
---|
Functions
anyToDate( value: ) |
Returns Converts anything to Date object. |
---|---|
anyToNumber( value: ) |
Returns Tries converting any value to a number. |
camelToDashed( str: ) |
Returns Converts camelCased text to dashed version: ("thisIsString" > "this-is-string") |
capitalize( str: ) |
Returns Converts tring to uppercase. @todo Maybe make it better |
copyProperties( source: ) |
Returns Copies all properties of one object to the other, omitting undefined. @todo Maybe consolidate with utils.copy? |
documentPointToSprite( ) |
Returns Converts document-wide global coordinates to coordinates within specific |
documentPointToSvg( point: ) |
Returns Converts global document-wide coordinates to coordinates within SVG element. |
escapeForRgex( value: ) |
Returns Escapes string so it can safely be used in a Regex. |
fitNumber( value: ) |
Returns Fits the number into specific |
fitNumberRelative( value: ) |
Returns Fits the number into specific If the value is does not fit withing specified range, it "wraps" around the values. For example, if we have input value 10 with min set at 1 and max set at 8, the value will not fit. The remainder that does not fit (2) will be added to The output of regular |
get12Hours( hours: ) |
Returns Returns 12-hour representation out of the 24-hour hours. |
getBaseURI() |
Returns |
getDayFromWeek( week: ) |
Returns Returns a year day out of the given week number. |
getMonthWeek( date: ) |
Returns Returns a week number in the month. |
getPixelRatio() |
Returns Returns pixel ratio of the current screen (used on retina displays). |
getTimeZone( date: ) |
Returns Returns a string name of the tome zone. |
getWeek( date: ) |
Returns Returns week number for a given date. @todo Account for UTC |
getYearDay( date: ) |
Returns Returns a year day. @todo Account for UTC |
isIE() |
Returns Detects MSIE. |
isNotEmpty( value: ) |
Returns Checks if value is not empty (undefined or zero-length string). |
ltrim( str: ) |
Returns Removes whitespace from beginning of the string. |
numberToString( value: ) |
Returns Converts numeric value into string. Deals with large or small numbers that would otherwise use exponents. |
padString( value: ) |
Returns Pads a string with additional characters to certain length. |
plainText( text: ) |
Returns Removes new lines and tags from a string. |
random( chars: ) |
Returns Returns a random number between |
reverseString( str: ) |
Returns Reverses string. |
rtrim( str: ) |
Returns Removes whitespace from end of the string. |
softCopyProperties( source: ) |
Returns Copies all properties of one object to the other, omitting undefined, but only if property in target object doesn't have a value set. @todo Maybe consolidate with utils.copy? |
splitTextByCharCount( text: ) |
Returns Splits the text into multiple lines, respecting maximum character count. Prioretizes splitting on spaces and punctuation. Falls back on splitting mid-word if there's no other option. |
spritePointToDocument( ) |
Returns Converts coordinates within |
spritePointToSprite( point: ) |
Returns Converts coordinates of one sprite to another. |
spritePointToSvg( ) |
Returns Converts coordinates within |
spriteRectToSvg( rect: ) |
Returns Converts a rectangle expressed in |
stringify( value: ) |
Returns Converts any value into its string representation. |
stripHash( url: ) |
Returns Removes target from url |
stripTags( text: ) |
Returns Strips all tags from the string. |
svgPointToDocument( point: ) |
Returns Converts SVG coordinates to global document-wide coordinates. |
svgPointToSprite( ) |
Returns Converts SVG element coordinates to coordinates within specific |
svgRectToSprite( rect: ) |
Returns Converts a rectangle expressed in SVG element coordinates to coordinates within specific |
trim( str: ) |
Returns Removes whitespace from beginning and end of the string. |
truncateWithEllipsis( text: ) |
Returns Truncates the text to certain character count. Will add ellipsis if the string is truncated. Optionally, can truncate on full words only. For RTL support, pass in the fifth parameter as |
unquote( str: ) |
Returns Removes quotes from the string. |
used( value: ) |
Returns Marks a value as being used (e.g. because the value has side effects). |