FUNCTIONS.
Usage
Examples:
Input | Functions | Output |
---|---|---|
Placide | $label().$limitStart(3 ,... ).$toUpperCase() | PLA... |
[FR]France[country] | $label().$replaceRegex(\\(\[a-z\]\*\\) , ) | France |
PRODUCT_fruits | $label().$slice(8 ).$Capitalize() | FRUITS |
[12, 5, 3.76] | $value(1 ).$format($0.0 ) | $5.0 |
[12, 5, 3.76] | $value(2 ).$round(1 ) | 3.8 |
[12, 5, 3.76] | $value(0 ).$rankAsc().$format(0"/3 players" ) | 3/3 players |
How to use the index
reference:
The reference to a value or a label depends on where the function is called:
From the point of a graph, a bar, a part of a pie chart... by default, it uses the
current index
(0
for bar 1,1
for bar 2...).From an element external to the graph (title, legend, etc.), the
index
used is the one specified to the function as a parameter.
How to combine values and labels functions:
Value "Search" functions can be chained with label functions, for example: $max().$label().$toUpperCase() gives you the label associated with the largest value and makes it uppercase.
How to format values:
Formats are explained here.
Text functions
Functions | (Params, [optional]) Description |
---|---|
Selection: | |
$label | (index) Returns the label for the current index if index not specified (or at index 0 if used outside the chart, like title or legend...). |
$title | Returns the title for the current dataset (must be prefixed with $dataset(index ) function). |
$axis | (axis) Returns the axis label for axis index . Axis could be left , right , top , bottom or radial . |
Search: | |
$first | Returns the first label of the current dataset. |
$last | Returns the last label of the current dataset. |
$min | Returns the first label of the current dataset sorted alphabetically. |
$max | Returns the last label of the current dataset sorted alphabetically. |
Date: | |
$date | (formatIn, formatOut) Convert a valid date label with the formatIn format to the formatOut format. You can find more information on day.js. For formatIn you can also use the following: ISO for YYYY-MM-DDT:hh:mm:ssZ ; ISOD for YYYY-MM-DD ; ISOT for hh:mm:ss |
Functions: | |
$toUpperCase | Convert the calling string to uppercase. |
$toLowerCase | Convert the calling string to lowercase. |
$trim | Removes whitespace from both ends of the calling string. |
$trimEnd | Removes whitespace from the end of the calling string. |
$trimStart | Removes whitespace from the beginning of the calling string. |
$capitalize | Convert to uppercase the first character of the calling string (and convert to lowercase the rest) |
$capitalizeAll | Convert to uppercase the first character of each word of the calling string (and convert to lowercase the rest) |
$slice | (start, end) Extracts a section of a string from de start index to the end index (or to the end of the string if omitted). Zero-based index: first character is at index 0 |
$replace | (substring, replacement) Replace the first match of the substring by the replacement string. |
$replaceAll | (substring, replacement) Replace all match of the substring by the replacement string. |
$replaceRegex | (expression, replacement, [flags]) Replace all match of the RegExp by the replacement string using the optionals flags . |
$limitEnd | (amount, [ellipsis]) Keep the last amount of characters of the calling string and replace it by the optional ellipsis string. |
$limitStart | (amount, [ellipsis]) Keep the first amount of characters of the calling string and replace it by the optional ellipsis string. |
Number functions
Functions | (Params, [optional]) Description |
---|---|
Selection: | |
$dataset | (index) Returns the values for the current dataset if index not specified (or at index 0 if used outside the chart, like title or legend...). Note: should be used as a prefix to $value to enforce a specific dataset. |
$category | (index) Returns the values for category (i.e. values for a specific label) at index . Note: should be used as a prefix to $value to enforce a specific category. |
$stack | (index) Returns the values for stack at index . Note: should be used as a prefix to $value to enforce a specific stack. |
$value | (index) Returns the label for the current index of the current dataset if index not specified (or at index 0 if used outside the chart, like title or legend...). |
Search: | |
$first | (index) Returns the first value of the current dataset, or, if specified the value at the index rank. |
$last | (index) Returns the last value of the current dataset, or, if specified the value at the index rank. |
$min | (index) Returns the first value of the current dataset sorted in ascending order, or, if specified the value at the index rank. |
$max | (index) Returns the last value of the current dataset sorted in ascending order, or, if specified the value at the index rank. |
Math: | |
$range | The range is the difference between the lowest and highest values. |
$midRange | The midrange is the point half way between the two most extreme values. |
$median | The median is the "middle" of a list of values. |
$mean | The mean is the sum of the values divided by the number of values. |
$count | The number of values (excluding null values). |
$countDistinct | The number of values (excluding null values). |
$countAll | The number of values (including null values). |
$countAllDistinct | The number of values (including null values). |
$sum | The sum of values. |
$share | The share is the value divided by the sum of values. |
$rankDesc | Rank of the value with values sorted in descending order. |
$rankAsc | Rank of the value with values sorted in ascending order. |
Functions: | |
$format | (format) Convert the calling value to the specified format (see formats documentation). |
$trunc | (decimal) Remove fractional digits from the calling value up to specified decimal (default: 0 ) |
$round | (decimal) Round the calling value to the nearest value up to specified decimal (default: 0 ) |
$ceil | (decimal) Round the calling value to the largest value up to specified decimal (default: 0 ) |
$floor | (decimal) Round the largest value less than or equal to the calling value up to specified decimal (default: 0 ) |
$abs | Returns the absolute value of the calling value. |
Formats
Custom number formats have a specific structure. Each number format can have up to 3 sections, separated with semi-colons as follows:
Positive values
Negative values
Zero values
Symbol | Description |
---|---|
0 | Display insignificant zeros. |
# | Display significant digits. |
. | Decimal point. Can be personalized. |
, | Thousands separator. Can be personalized. |
E | Scientific notation. |
/ | Fraction bar |
% | Percent sign. Note: multiply the value by 100. |
"" | Quotation marks. Use text in quotation marks to display it literally. |
Exemple | Format | Output for: 1234567 | Output for: -1234567 | Output for: 0 |
Plus and minus sign | +#,##0;-#,##0;0 | 1,234,567 | -1,234,567 | 0 |
Thousands | #,##0, | 1,235 | -1,235 | 0 |
Millions | #,##0,," M" | 1 M | -1 M | 0 M |
Hide zero | #,##0;-#,##0; | 1,234,567 | -1,234,567 | |
Currency Euros right (€) | #,##0" €" | 1,234,567 € | -1,234,567 € | 0 € |
US Currency (negatives in parentheses) | $#,##0;$(#,##0) | $1,234,567 | $(1,234,567) | $0 |
Scientific Notation | 0.00E+0 | 1.23E+6 | -1.23E+6 | 0 |
Exemple | Format | Output for: 1.5 | Output for: -1.5 | Output for: 0 |
Percentage | 0% | 150% | -150% | % |
Fractions | 0/0 | 3/2 | -3/2 | 0 |
Degrees Celsius | 0.0#"°C" | 1.5°C | -1.5°C | 0.0°C |
INTEGRATION.
iFrame
The integration of your charts is possible via the use of an iFrame, you can restrict the access URLs to your charts via the editor.
Events
Make your charts interactive by collecting events triggered by:
a click on a chart element
a click on the actions bar
update chart ending