diff --git a/docs/canvas/canvas-client-functions.asciidoc b/docs/canvas/canvas-client-functions.asciidoc index 48e47b713efaf..fdcf43a8867c8 100644 --- a/docs/canvas/canvas-client-functions.asciidoc +++ b/docs/canvas/canvas-client-functions.asciidoc @@ -9,71 +9,171 @@ or interact with the workpad to read filters. A *** denotes a required argument. +A *†* denotes an argument can be passed multiple times. + [float] -=== asset +[[asset_fn]] +=== `asset` Uses Canvas workpad asset objects to provide argument values. Usually images. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string +|_Unnamed_ *** +|`string` |The ID of the asset value to return |=== -*Returns:* string +*Returns:* `string` [float] -=== browser +[[filters_fn]] +=== `filters` -Forces the interpreter to return to the browser. +Collects element filters on the workpad, usually to provide them to a data source. -*Accepts:* Anything or nothing +*Accepts:* `null` -*Returns:* Depends on your input and arguments +*Returns:* `filter` [float] -=== filters +[[location_fn]] +=== `location` -Collects element filters on the workpad, usually to provide them to a data source. +Uses the browser's location functionality to get your current location. Usually +quite slow, but fairly accurate. -*Accepts:* null +*Accepts:* `null` -*Returns:* filter +*Returns:* `datatable` [float] -=== location +[[markdown_fn]] +=== `markdown` -Uses the browser's location functionality to get your current location. Usually -quite slow, but fairly accurate. +Adds an element for rendering Markdown text. Great for single numbers, metrics, or paragraphs of text. + +*Accepts:* `datatable`, `null` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|_Unnamed_ *†* -*Accepts:* null +Alias: `expression`, `content` +|`string` +|A `string` containing Markdown. You can pass this multiple +times to achieve concatenation -*Returns:* datatable +Default: `""` + +|`font` +|`style` +|Font settings. Technically, you can put other styles in here too + +Default: `{<>}` +|=== + +*Returns:* `render` [float] -=== urlparam +[[timelion_fn]] +=== `timelion` -Accesses URL parameters and use them in expressions. This will always return a string. +Uses Timelion to extract one or more time series from many sources. -*Accepts:* null +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Aliases: `var`, `variable`) -|string +|_Unnamed_ + +Aliases: `q`, `query` +|`string` +|A Timelion query + +Default: `".es(*)"` + +|`interval` +|`string` +|Bucket interval for the time series + +Default: `"auto"` + +|`from` +|`string` +|{es} `datemath` string for the start of the time range + +Default: `"now-1y"` + +|`to` +|`string` +|{es} date math `string` for the end of the time range + +Default: `"now"` + +|`timezone` +|`string` +|Time zone for the time range + +Default: `"UTC"` +|=== + +*Returns:* `datatable` + +[float] +[[to_fn]] +=== `to` + +Explicitly casts from one type to another. + +*Accepts:* `any` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|_Unnamed_ *** + +Alias: `type` +|`string` +|A known type +|=== + +*Returns:* Depends on your input and arguments + +[float] +[[urlparam_fn]] +=== `urlparam` + +Accesses URL parameters and use them in expressions. This will always return a `string`. + +*Accepts:* `null` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|_Unnamed_ *** + +Aliases: `var`, `variable` +|`string` |The URL hash parameter to access -|default -|string -|Return this string if the url parameter is not defined (default: `""`) +|`default` +|`string` +|Return this `string` if the url parameter is not defined + +Default: `""` |=== -*Returns:* string +*Returns:* `string` + diff --git a/docs/canvas/canvas-common-functions.asciidoc b/docs/canvas/canvas-common-functions.asciidoc index 58de65d2753ba..8cb55e25fdbdf 100644 --- a/docs/canvas/canvas-common-functions.asciidoc +++ b/docs/canvas/canvas-common-functions.asciidoc @@ -6,640 +6,765 @@ The common functions can run anywhere, which means they'll execute wherever the expression is currently executing. For example, if the engine is currently running on the server, the functions will run on the server. -A *** denotes a required argument. +A *** denotes a required argument. +A *†* denotes an argument can be passed multiple times. [float] -=== all +[[all_fn]] +=== `all` -Returns true if all of the conditions are true. +Returns `true` if all of the conditions are `true`. See also <>. -*Accepts:* Anything or nothing +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean +|_Unnamed_ *** *†* + +Alias: `condition` +|`boolean` |The conditions to check |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== alterColumn +[[alterColumn_fn]] +=== `alterColumn` -Converts between core types, for example, string, number, null, boolean, date -and rename columns. +Converts between core types, for example, `string`, `number`, `null`, `boolean`, `date` and renames columns. See also <> and <>. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|column* -|string +|_Unnamed_ *** + +Alias: `column` +|`string` |The name of the column to alter -|type -|string -|The type to convert the column to; leave blank to not change type (default: `null`) +|`type` +|`string` +|The type to convert the column to; leave blank to not change type -|name -|string -|The resultant column name; leave blank to not rename (default: `null`) +|`name` +|`string` +|The resultant column name; leave blank to not rename |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== any +[[any_fn]] +=== `any` -Returns true if any of the conditions are true. +Returns `true` if any of the conditions are `true`. See also <>. -*Accepts:* Anything or nothing +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean +|_Unnamed_ *** *†* + +Alias: `condition` +|`boolean` |The conditions to check |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== as +[[as_fn]] +=== `as` -Creates a datatable with a single value. +Creates a `datatable` with a single value. See also <>. -*Accepts:* string, boolean, number, null +*Accepts:* `string`, `boolean`, `number`, `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ (Alias: `name`) -|string -|A name to give the column (default: `value`) +|_Unnamed_ + +Alias: `name` +|`string` +|A name to give the column + +Default: `"value"` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== axisConfig +[[axisConfig_fn]] +=== `axisConfig` -Configures axis of a visualization. +Configures axis of a visualization, only used in <> -*Accepts:* datatable +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|show -|boolean -|default: `true` +|`show` +|`boolean` +|Show the axis labels? + +Default: `true` + +|`position` +|`string` +|The position of the axis labels, for example, top, bottom, left, and right + +Default: `"left"` + +|`min` +|`number`, `string`, `null` +|Minimum value displayed in the axis. Must be a `number`, a date in milliseconds since epoch, or an ISO8601 `string` + +|`max` +|`number`, `string`, `null` +|Maximum value displayed in the axis. Must be a `number`, a date in milliseconds since epoch, or an ISO8601 `string` -|position -|string -|The position of the axis labels, for example, top, bottom, left, and right +|`tickSize` +|`number`, `null` +|Increment size between each tick. Use for `number` axes only. |=== -*Returns:* axisConfig +*Returns:* `axisConfig` [float] -=== case +[[case_fn]] +=== `case` -Builds a case (including a condition/result) to pass to the switch function. +Builds a `case` (including a condition/result) to pass to the <> function. -*Accepts:* Anything or nothing +*Accepts:* `any` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ -|any -|This value is compared to the context to see if the condition -s met. It is overridden by the "if" argument if both are provided. +|_Unnamed_ + +Alias: `when` +|`any` +|This value is compared to the _context_ to see if the condition +is met. It is overridden by the "if" argument if both are provided. -|if* -|boolean +|`if` +|`boolean` |This value determines whether or not the condition is met. It overrides the unnamed argument if both are provided. -|then -|any +|`then` *** +|`any` |The value to return if the condition is met |=== -*Returns:* case +*Returns:* `case` + [float] -=== clog +[[clear_fn]] +=== `clear` -Outputs the context to the console. +Clears _context_ and returns `null` -*Accepts:* Anything or nothing +*Accepts:* `null` -*Returns:* Depends on your input and arguments +*Returns:* `null` [float] -=== columns +[[columns_fn]] +=== `columns` Includes or excludes columns from a data table. If you specify both, this will exclude first. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|include -|string +|`include` +|`string` |A comma separated list of column names to keep in the table -(default: `null`) -|exclude -|string +|`exclude` +|`string` |A comma separated list of column names to remove from the table -(default: `null`) |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== compare +[[compare_fn]] +=== `compare` -Compares the input to something else to determine true or false. -Usually used in combination with `if`. This only works with primitive types, -such as number, string, and boolean. +Compares the input to something else to determine `true` or `false`. +Usually used in combination with <>. This only works with primitive types, +such as `number`, `string`, and `boolean`. See also <>, <>, <>, <>, <>, and <>. -*Accepts:* null, string, number, boolean +*Accepts:* `string`, `number`, `boolean`, `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ (Alias: `op`) -|string -|The operator to use in the comparison: `eq` (equal), `ne` (not equal), `lt` -(less than), `gt` (greater than), `lte` (less than equal), `gte` (greater than eq). -The default is `eq`. +|_Unnamed_ -|to (Aliases: `this`, `b`) -|any -|The value to compare the context to, usually returned by a subexpression +Alias: `op` +|`string` +|The operator to use in the comparison: `eq` (equal to), `gt` (greater than), `gte` (greater than or equal to), `lt` (less than), `lte` (less than or equal to), `ne` or `neq` (not equal to). + +Default: `"eq"` + +|`to` + +Alias: `this`, `b` +|`any` +|The value to compare the _context_ to, usually returned by a subexpression |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== containerStyle +[[containerStyle_fn]] +=== `containerStyle` Creates an object used for describing the properties of a series on a chart. You would usually use this inside of a charting function. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|border -|string +|`border` +|`string` |Valid CSS border string -|borderRadius -|string +|`borderRadius` +|`string` |Number of pixels to use when rounding the border -|padding -|string +|`padding` +|`string` |Content distance in pixels from border -|backgroundColor -|string +|`backgroundColor` +|`string` |Valid CSS background color string -|backgroundImage -|string +|`backgroundImage` +|`string` |Valid CSS background image string -|backgroundSize -|string -|Valid CSS background size string (default: `contain`) +|`backgroundSize` +|`string` +|Valid CSS background size string + +Default: `"contain"` + +|`backgroundRepeat` +|`string` +|Valid CSS background repeat string -|backgroundRepeat -|string -|Valid CSS background repeat string (default: `no-repeat`) +Default: `"no-repeat"` -|opacity -|number +|`opacity` +|`number` |A number between 0 and 1 representing the degree of transparency of the element |=== -*Returns:* containerStyle +*Returns:* `containerStyle` [float] -=== context +[[context_fn]] +=== `context` Returns whatever you pass into it. This can be useful when you need to use -context as argument to a function as a sub-expression. +context as an argument to a function as a sub-expression. -*Accepts:* Anything or nothing +*Accepts:* `any` -*Returns:* Depends on your input and arguments +*Returns:* Original _context_ [float] -=== csv +[[csv_fn]] +=== `csv` -Creates a datatable from CSV input. +Creates a `datatable` from CSV input. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string +|_Unnamed_ *** + +Alias: `data` +|`string` |CSV data to use -|delimiter* -|string +|`delimiter` +|`string` |Data separation character -|newLine* -|string +|`newLine` +|`string` |Row separation character |=== -*Returns:* containerStyle +*Returns:* `datatable` [float] -=== date +[[date_fn]] +=== `date` -Returns the current time, or a time parsed from a string, as milliseconds since epoch. +Returns the current time, or a time parsed from a `string`, as milliseconds since epoch. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description |_Unnamed_ -|string + +Alias: `value` +|`string` |An optional date string to be parsed into milliseconds since epoch. Can be either a valid JavaScript Date input or a string to parse -using the format argument. Must be an ISO 8601 string or you must provide the format. +using the format argument. Must be an ISO8601 string or you must provide the format. -|format* -|string -|The Moment.js format for parsing the optional date -string. See the https://momentjs.com/docs/#/displaying/[Moment.js documentation]. +|`format` +|`string` +|The MomentJS format for parsing the optional date +`string`. See the https://momentjs.com/docs/#/displaying/[MomentJS documentation]. |=== -*Returns:* number +*Returns:* `number` [float] -=== do +[[do_fn]] +=== `do` Runs multiple sub-expressions. Returns the passed in context. Nice for running actions producing functions. -*Accepts:* Anything or nothing +*Accepts:* `any` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ -|any +|_Unnamed_ *†* + +Aliases: `expression`, `exp`, `fn`, `function` +|`any` |One or more sub-expressions. The value of these is not available in the root pipeline as this function simply returns the passed in context. |=== -*Returns:* Depends on your input and arguments +*Returns:* original _context_ [float] -=== dropdownControl +[[dropdownControl_fn]] +=== `dropdownControl` Configures a dropdown filter control element. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|filterColumn -|any +|`filterColumn` *** +|`string` |The column or field to which to attach the filter -|valueColumn -|any -|The datatable column from which to extract the unique values +|`valueColumn` *** +|`string` +|The column or field from which to extract the unique values for the dropdown + +|`filterGroup` +|`string` +|Group name for the filter |=== -*Returns:* render +*Returns:* `render` [float] -=== eq +[[eq_fn]] +=== `eq` -Returns whether the context is equal to the argument. +Returns whether the _context_ is equal to the argument -*Accepts:* Anything or nothing +*Accepts:* `boolean`, `number`, `string`, `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean, number, string +|_Unnamed_ *** + +Alias: `value` +|`boolean`, `number`, `string`, `null` |The value to which to compare the context |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== exactly +[[exactly_fn]] +=== `exactly` Creates a filter that matches a given column for a perfectly exact value. -*Accepts:* filter +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|column* (Aliases: `field`, `c`) -|string +|`column` *** + +Aliases: `field`, `c` +|`string` |The column or field to attach the filter to -|value* (Aliases: `v`, `val`) -|string +|`value` *** + +Aliases: `v`, `val` +|`string` |The value to match exactly, including white space and capitalization + +|`filterGroup` +|`string` +|Group name for the filter |=== -*Returns:* filter +*Returns:* `filter` [float] -=== filterrows +[[filterrows_fn]] +=== `filterrows` -Filters rows in a datatable based on the return value of a subexpression. +Filters rows in a `datatable` based on the return value of a subexpression. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Alias: `fn`) -|boolean -|An expression to pass into each row in the datatable. -The expression should return a boolean. A true value preserves the row, -and a false value removes it. +|_Unnamed_ *** + +Aliases: `fn`, `exp`, `expression` +|`boolean` +|An expression to pass into each row in the `datatable.` +The expression should return a `boolean`. A `true` value preserves the row, +and a `false` value removes it. |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== font +[[font_fn]] +=== `font` Creates font style. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|size -|number -|The font size in pixels (default: `14`) +|`size` +|`number` +|The font size in pixels + +Default: `14` + +|`lHeight` -|lHeight* (Alias: `lineHeight`) -|number +Alias: `lineHeight` +|`number`, `null` |The line height in pixels -|family -|string -|An acceptable CSS web font string (default: `"'Open Sans', Helvetica, Arial, sans-serif"`) +|`family` +|`string` +|An acceptable CSS web font string -|color -|string +Default: `"'Open Sans', Helvetica, Arial, sans-serif"` + +|`color` +|`string` |The text color -|weight -|string -|The font weight, for example, `normal`, `bold`, `bolder`, `lighter`, -`100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` (default is `normal`) +|`weight` +|`string` +|The font weight, for example, `"normal"`, `"bold"`, `"bolder"`, `"lighter"`, +`"100"`, `"200"`, `"300"`, `"400"`, `"500"`, `"600"`, `"700"`, `"800"`, `"900"` + +Default: `"normal"` + +|`underline` +|`boolean` +|Underline the text? -|underline -|boolean -|Underline the text, `true` or `false` (default is `false`) +Default: `false` -|italic -|boolean -|Italicize the text, `true` or `false` (default is `false`) +|`italic` +|`boolean` +|Italicize the text? -|align -|string -|The horizontal alignment of text (default is `left`) +Default: `false` + +|`align` +|`string` +|The horizontal alignment of text + +Default: `left` |=== -*Returns:* style +*Returns:* `style` [float] -=== formatdate +[[formatdate_fn]] +=== `formatdate` -Outputs milliseconds since epoch as a formatted string. +Format a valid date string or number of milliseconds since epoch using https://momentjs.com/[MomentJS] -*Accepts:* number +*Accepts:* `number`, `string` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string -|Moment.js Format with which to bucket, see the https://momentjs.com/docs/#/displaying/[Moment.js documentation] +|_Unnamed_ *** + +Alias: `format` +|`string` +|MomentJS Format with which to bucket, see the https://momentjs.com/docs/#/displaying/[MomentJS documentation] |=== -*Returns:* string +*Returns:* `string` [float] -=== formatnumber +[[formatnumber_fn]] +=== `formatnumber` -Turns a number into a string using a Number.js format. +Turns a `number` into a `string` using a NumeralJS format. -*Accepts:* number +*Accepts:* `number` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string -|Numeral.js format string, see the http://numeraljs.com/#format[Numeral.js documentation] +|_Unnamed_ *** + +Alias: `format` +|`string` +|NumeralJS format string, see the http://numeraljs.com/#format[NumeralJS documentation] |=== -*Returns:* string +*Returns:* `string` [float] -=== getCell +[[getCell_fn]] +=== `getCell` Fetches a single cell in a table. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Aliases: `column`, `c`) -|string -|The name of the column value to fetch +|_Unnamed_ + +Aliases: `column`, `c` +|`string` +|The name of the column value to fetch, defaults to the first column + +|`row` + +Alias: `r` +|`number` +|The row number, starting at 0 -|row (Alias: `r`) -|number -|The row number, starting at 0 (default: `0`) +Default: `0` |=== -*Returns:* Depends on your input and arguments +*Returns:* Depends on the data in the cell [float] -=== gt +[[gt_fn]] +=== `gt` -Returns whether the context is greater than the argument. +Returns whether the _context_ is greater than the argument. -*Accepts:* Anything or nothing +*Accepts:* `number`, `string` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean, number, string -|The value to compare the context to +|_Unnamed_ *** + +Alias: `value` +|`number`, `string` +|The value to compare the _context_ to |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== gte +[[gte_fn]] +=== `gte` -Returns whether the context is greater than or equal to the argument. +Returns whether the _context_ is greater than or equal to the argument. -*Accepts:* Anything or nothing +*Accepts:* `number`, `string` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean, number, string -|The value to compare the context to +|_Unnamed_ *** + +Alias: `value` +|`number`, `string` +|The value to compare the _context_ to |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== head +[[head_fn]] +=== `head` -Gets the first N rows from the datatable. Also see `tail`. +Gets the first N rows from the `datatable`. See also <>. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description |_Unnamed_ -|number -|Return this number of rows from the beginning of the datatable (default: `1`) + +Alias: `count` +|`number` +|Return this number of rows from the beginning of the `datatable` + +Default: `1` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== if +[[if_fn]] +=== `if` Performs conditional logic. -*Accepts:* Anything or nothing +*Accepts:* `any` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ (Alias: `condition`) -|boolean -|A boolean true or false, usually returned by a subexpression. -If this is not supplied, then the input context will be used. +|_Unnamed_ -|then -|any -|The return value if true +Alias: `condition` +|`boolean` +|A `true` or `false`, usually returned by a subexpression. +If this is not supplied, then the input _context_ will be used. -|else -|any -|The return value if false. If else is not specified, and the condition is false, -then the input context to the function will be returned. +|`then` +|`any` +|The return value if `true` + +|`else` +|`any` +|The return value if `false`. If else is not specified, and the condition is `false`, +then the input _context_ to the function will be returned. |=== *Returns:* Depends on your input and arguments [float] -=== image +[[image_fn]] +=== `image` Displays an image. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|dataurl (Alias: `_,`, `url`) -|string +|_Unnamed_ + +Aliases: `dataurl`, `url` +|`string`, `null` |An image asset can be provided as a base64 dataurl, or passed in as a subexpression (see example below) -|mode -|string -|`contain` +|`mode` +|`string` +|`"contain"` will show the entire image, scaled to fit. +'`"cover"` will fill the container with the image, cropping from the sides or bottom as needed. +`"stretch"` will resize the height and width of the image to 100% of the container'. + + +Default: `"contain"` |=== Example value for the `dataurl` argument, formatted as a base64 data URL: @@ -648,370 +773,489 @@ Example value for the `dataurl` argument, formatted as a base64 data URL: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmlld0JveD0iMCAwIDI3MC42MDAwMSAyNjkuNTQ2NjYiCiAgIGhlaWdodD0iMjY5LjU0NjY2IgogICB3aWR0aD0iMjcwLjYwMDAxIgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBpZD0ic3ZnMiIKICAgdmVyc2lvbj0iMS4xIj48bWV0YWRhdGEKICAgICBpZD0ibWV0YWRhdGE4Ij48cmRmOlJERj48Y2M6V29yawogICAgICAgICByZGY6YWJvdXQ9IiI+PGRjOmZvcm1hdD5pbWFnZS9zdmcreG1sPC9kYzpmb3JtYXQ+PGRjOnR5cGUKICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPjwvY2M6V29yaz48L3JkZjpSREY+PC9tZXRhZGF0YT48ZGVmcwogICAgIGlkPSJkZWZzNiIgLz48ZwogICAgIHRyYW5zZm9ybT0ibWF0cml4KDEuMzMzMzMzMywwLDAsLTEuMzMzMzMzMywwLDI2OS41NDY2NykiCiAgICAgaWQ9ImcxMCI+PGcKICAgICAgIHRyYW5zZm9ybT0ic2NhbGUoMC4xKSIKICAgICAgIGlkPSJnMTIiPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMTQiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMjAyOS40OCw5NjIuNDQxIGMgMCwxNzAuMDk5IC0xMDUuNDYsMzE4Ljc5OSAtMjY0LjE3LDM3Ni42NTkgNi45OCwzNS44NiAxMC42Miw3MS43MSAxMC42MiwxMDkuMDUgMCwzMTYuMTkgLTI1Ny4yNCw1NzMuNDMgLTU3My40Nyw1NzMuNDMgLTE4NC43MiwwIC0zNTYuNTU4LC04OC41OSAtNDY0LjUzLC0yMzcuODUgLTUzLjA5LDQxLjE4IC0xMTguMjg1LDYzLjc1IC0xODYuMzA1LDYzLjc1IC0xNjcuODM2LDAgLTMwNC4zODMsLTEzNi41NCAtMzA0LjM4MywtMzA0LjM4IDAsLTM3LjA4IDYuNjE3LC03Mi41OCAxOS4wMzEsLTEwNi4wOCBDIDEwOC40ODgsMTM4MC4wOSAwLDEyMjcuODkgMCwxMDU4Ljg4IDAsODg3LjkxIDEwNS45NzcsNzM4LjUzOSAyNjUuMzk4LDY4MS4wOSBjIC02Ljc2OSwtMzUuNDQyIC0xMC40NiwtNzIuMDIgLTEwLjQ2LC0xMDkgQyAyNTQuOTM4LDI1Ni42MjEgNTExLjU2NiwwIDgyNy4wMjcsMCAxMDEyLjIsMCAxMTgzLjk0LDg4Ljk0MTQgMTI5MS4zLDIzOC44MzIgYyA1My40NSwtNDEuOTYxIDExOC44LC02NC45OTIgMTg2LjU2LC02NC45OTIgMTY3LjgzLDAgMzA0LjM4LDEzNi40OTIgMzA0LjM4LDMwNC4zMzIgMCwzNy4wNzggLTYuNjIsNzIuNjI5IC0xOS4wMywxMDYuMTI5IDE1Ny43OCw1Ni44NzkgMjY2LjI3LDIwOS4xMjkgMjY2LjI3LDM3OC4xNCIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDE2IgogICAgICAgICBzdHlsZT0iZmlsbDojZmFjZjA5O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJtIDc5Ny44OTgsMTE1MC45MyA0NDQuMDcyLC0yMDIuNDUgNDQ4LjA1LDM5Mi41OCBjIDYuNDksMzIuMzkgOS42Niw2NC42NyA5LjY2LDk4LjQ2IDAsMjc2LjIzIC0yMjQuNjgsNTAwLjk1IC01MDAuOSw1MDAuOTUgLTE2NS4yNCwwIC0zMTkuMzcsLTgxLjM2IC00MTMuMDUzLC0yMTcuNzkgbCAtNzQuNTI0LC0zODYuNjQgODYuNjk1LC0xODUuMTEiIC8+PHBhdGgKICAgICAgICAgaWQ9InBhdGgxOCIKICAgICAgICAgc3R5bGU9ImZpbGw6IzQ5YzFhZTtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIKICAgICAgICAgZD0ibSAzMzguMjIzLDY4MC42NzIgYyAtNi40ODksLTMyLjM4MyAtOS44MDksLTY1Ljk4MSAtOS44MDksLTk5Ljk3MyAwLC0yNzYuOTI5IDIyNS4zMzYsLTUwMi4yNTc2IDUwMi4zMTMsLTUwMi4yNTc2IDE2Ni41OTMsMCAzMjEuNDczLDgyLjExNzYgNDE1LjAxMywyMTkuOTQ5NiBsIDczLjk3LDM4NS4zNDcgLTk4LjcyLDE4OC42MjEgTCA3NzUuMTU2LDEwNzUuNTcgMzM4LjIyMyw2ODAuNjcyIiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjAiCiAgICAgICAgIHN0eWxlPSJmaWxsOiNlZjI5OWI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMzM1LjQxLDE0NDkuMTggMzA0LjMzMiwtNzEuODYgNjYuNjgsMzQ2LjAyIGMgLTQxLjU4NiwzMS43OCAtOTIuOTMsNDkuMTggLTE0NS43MzEsNDkuMTggLTEzMi4yNSwwIC0yMzkuODEyLC0xMDcuNjEgLTIzOS44MTIsLTIzOS44NyAwLC0yOS4yMSA0Ljg3OSwtNTcuMjIgMTQuNTMxLC04My40NyIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDIyIgogICAgICAgICBzdHlsZT0iZmlsbDojNGNhYmU0O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJNIDMwOC45OTIsMTM3Ni43IEMgMTczLjAyLDEzMzEuNjQgNzguNDgwNSwxMjAxLjMgNzguNDgwNSwxMDU3LjkzIDc4LjQ4MDUsOTE4LjM0IDE2NC44Miw3OTMuNjggMjk0LjQwNiw3NDQuMzUyIGwgNDI2Ljk4MSwzODUuOTM4IC03OC4zOTUsMTY3LjUxIC0zMzQsNzguOSIgLz48cGF0aAogICAgICAgICBpZD0icGF0aDI0IgogICAgICAgICBzdHlsZT0iZmlsbDojODVjZTI2O2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIgogICAgICAgICBkPSJtIDEzMjMuOCwyOTguNDEgYyA0MS43NCwtMzIuMDkgOTIuODMsLTQ5LjU5IDE0NC45OCwtNDkuNTkgMTMyLjI1LDAgMjM5LjgxLDEwNy41NTkgMjM5LjgxLDIzOS44MjEgMCwyOS4xNiAtNC44OCw1Ny4xNjggLTE0LjUzLDgzLjQxOCBsIC0zMDQuMDgsNzEuMTYgLTY2LjE4LC0zNDQuODA5IiAvPjxwYXRoCiAgICAgICAgIGlkPSJwYXRoMjYiCiAgICAgICAgIHN0eWxlPSJmaWxsOiMzMTc3YTc7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gMTM4NS42Nyw3MjIuOTMgMzM0Ljc2LC03OC4zMDEgYyAxMzYuMDIsNDQuOTYxIDIzMC41NiwxNzUuMzUxIDIzMC41NiwzMTguNzYyIDAsMTM5LjMzOSAtODYuNTQsMjYzLjg1OSAtMjE2LjM4LDMxMy4wMzkgbCAtNDM3Ljg0LC0zODMuNTkgODguOSwtMTY5LjkxIiAvPjwvZz48L2c+PC9zdmc+ ------------- -*Returns:* image +*Returns:* `image` [float] -=== lt +[[lt_fn]] +=== `lt` -Returns whether the context is less than the argument passed in. +Returns whether the _context_ is less than the argument passed in. -*Accepts:* Anything or nothing +*Accepts:* `number`, `string` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean, number, string -|The value to compare the context to -|=== - -*Returns:* boolean - - -[float] -=== lte - -Returns whether the context is less than or equal to the argument passed in. - -*Accepts:* Anything or nothing - -[cols="3*^<"] -|=== -|Argument |Type |Description +|_Unnamed_ *** -|_Unnamed_* -|boolean, number, string -|The value to compare the context to +Alias: `value` +|`number`, `string` +|The value to compare the _context_ to |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== mapColumn +[[lte_fn]] +=== `lte` -Adds a column calculated as the result of other columns, or not. +Returns whether the _context_ is less than or equal to the argument passed in. -*Accepts:* datatable +*Accepts:* `number`, `string` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Alias: `column`) -|string -|The name of the resulting column +|_Unnamed_ *** -|expression (Aliases: `exp`, `fn`) -|boolean, number, string -|A Canvas expression that will be passed to each row as a single row datatable +Alias: `value` +|`number`, `string` +|The value to compare the _context_ to |=== -*Returns:* datatable +*Returns:* `boolean` [float] -=== markdown +[[mapColumn_fn]] +=== `mapColumn` -Adds an element for rendering Markdown text. Great for single numbers, metrics, or paragraphs of text. +Adds a column calculated as the result of other columns, or not. See also <> and <>. -*Accepts:* datatable, null +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ -|string -|A string containing Markdown. You can pass this multiple -times to achieve concatenation (default: `""`). +|_Unnamed_ *** -|font -|style -|Font settings. Technically, you can put other styles in here too (default is `{font}`). -|=== +Alias: `column` +|`string` +|The name of the resulting column + +|`expression` *** -*Returns:* render +Alias: `exp`, `fn`, `function` +|`boolean`, `number`, `string`, `null` +|A Canvas expression that will be passed to each row as a single row `datatable` +|=== +*Returns:* `datatable` [float] -=== math +[[math_fn]] +=== `math` -Interprets a math expression, with a number or datatable as context. Datatable -columns are available by their column name. If you pass in a number, it is -available as "value" (without the quotes). +Interprets a math expression, with a `number` or `datatable` as context. Datatable +columns are available by their column name. If you pass in a `number`, it is +available as `"value"` (without the quotes). -*Accepts:* number, datatable +*Accepts:* `number`, `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string +|_Unnamed_ *** + +Alias: `expression` +|`string` |An evaluated TinyMath expression, see <> |=== -*Returns:* number +*Returns:* `number` [float] -=== metric +[[metric_fn]] +=== `metric` A number with a label. -*Accepts:* string, null +*Accepts:* `number`, `string`, `null` [cols="3*^<"] |=== |Argument |Type |Description |_Unnamed_ -|string -|Text describing the metric (default is `""`) +|`string` +|Text describing the metric + +Default: `""` -|metricFont -|style +|`metricFont` +|`style` |Font settings for the metric. Technically, you can put other styles in here too. -The default is `{font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center lHeight=48}`. -|labelFont -|style +Default: `{<> size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center lHeight=48}`. + +|`labelFont` +|`style` |Font settings for the label. Technically you can put other styles in here too. -The default is `{font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}`. + +Default: `{<> size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}`. |=== -*Returns:* render +*Returns:* `render` [float] -=== neq +[[neq_fn]] +=== `neq` -Returns whether the context is not equal to the argument. +Returns whether the _context_ is not equal to the argument. -*Accepts:* Anything or nothing +*Accepts:* `boolean`, `number`, `string`, `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|boolean, number, string -|The value to compare the context to +|_Unnamed_ *** + +Alias: `value` +|`boolean`, `number`, `string`, `null` +|The value to compare the _context_ to |=== -*Returns:* boolean +*Returns:* `boolean` [float] -=== palette +[[palette_fn]] +=== `palette` -Creates a color palette. +Creates a color palette -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string -|Palette colors, rgba, hex, or HTML color string; you can pass this multiple times +|_Unnamed_ *** *†* + +Alias: `color` +|`string` +|Palette colors, rgba, hex, or HTML color string + +|`gradient` +|`boolean` +|Make a gradient, where supported + +Default: `false` -|gradient -|boolean -|Make a gradient, where supported (default: `false`) +|`reverse` +|`boolean` +|Reverse the palette -|reverse -|any -|Reverse the palette (default is `false`) +Default: `false` |=== -*Returns:* palette +*Returns:* `palette` [float] -=== pie +[[pie_fn]] +=== `pie` Configures a pie chart element. -*Accepts:* pointseries +*Accepts:* `pointseries` [cols="3*^<"] |=== |Argument |Type |Description -|palette -|palette -|A palette object for describing the colors to use on this pie (default: `{palette}`) +|`palette` +|`palette` +|A palette object for describing the colors to use on this pie -|seriesStyle -|seriesStyle +Default: `{<>}` + +|`seriesStyle` *†* +|`seriesStyle` |A style of a specific series -|radius -|any +|`radius` +|`string`, `number` |Radius of the pie as a percentage (between 0 and 1) of the available space. -Set to `auto` to automatically set radius (default: `auto`). +Set to `"auto"` to automatically set radius + +Default: `"auto"`) + +|`hole` +|`number` +|Draw a hole in the pie, 0-100, as a percentage of the pie radius -|hole -|number -|Draw a hole in the pie, 0-100, as a percentage of the pie radius (default: `0`) +Default: `0` -|labels -|boolean -|Show pie labels (default: `true`) +|`labels` +|`boolean` +|Show pie labels -|labelRadius -|number +Default: `true` + +|`labelRadius` +|`number` |The percentage of the area of container to use as a radius for the label circle -(default: `100`) -|font -|style -|The label font (default: `{font}`) -|legend -|string, boolean -|The legend position, `nw`, `sw`, `ne`, `se`, or `false` (default: `false`) +Default: `100` + +|`font` +|`style` +|The label font -|tilt -|number -|The percentage of tilt, where 1 is fully vertical and 0 is completely flat (default: `1`) +Default: `{<>}` + +|`legend` +|`string`, `boolean` +|The legend position, `"nw"`, `"sw"`, `"ne"`, `"se"`, or `false` + +Default: `false` + +|`tilt` +|`number` +|The percentage of tilt, where 1 is fully vertical and 0 is completely flat + +Default: `1` |=== -*Returns:* render +*Returns:* `render` [float] -=== plot +[[plot_fn]] +=== `plot` Configures a plot element. -*Accepts:* pointseries +*Accepts:* `pointseries` [cols="3*^<"] |=== |Argument |Type |Description -|seriesStyle -|seriesStyle +|`seriesStyle` *†* +|`seriesStyle` |A style of a specific series -|defaultStyle -|seriesStyle -|The default style to use for every series (default is `{seriesStyle points=5}`) +|`defaultStyle` +|`seriesStyle` +|The default style to use for every series + + +Default: `{<> points=5}` + +|`palette` +|`palette` +|A `palette` object for describing the colors to use on this plot + +Default: `{<>}` + +|`font` +|`style` +|The legend and tick mark fonts + +Default: `{<>}` + +|`legend` +|`string`, `boolean` +|The legend position, `"nw"`, `"sw"`, `"ne"`, `"se"`, or `false` -|palette -|palette -|A palette object for describing the colors to use on this plot (default is `{palette}`) +Default: `"ne"` -|font -|style -|The legend and tick mark fonts (default is `{font}`) +|`yaxis` +|`boolean`, `axisConfig` +|Axis configuration, or use `false` to disable -|legend -|string, boolean -|The legend position, `nw`, `sw`, `ne`, `se`, or `false` (default is `ne`) +Default: `true` -|yaxis -|boolean, axisConfig -|Axis configuration, or use `false` to disable (default is `true`) +|`xaxis` +|`boolean`, `axisConfig` +|Axis configuration, or use `false` to disable -|xaxis -|boolean, axisConfig -|Axis configuration, or use `false` to disable (default is `true`) +Default: `true` |=== -*Returns:* render +*Returns:* `render` [float] -=== ply +[[ply_fn]] +=== `ply` -Subdivides a datatable and passes the resulting tables into an expression, +Subdivides a `datatable` and passes the resulting tables into an expression, then merges the output. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|by* -|string +|`by` *** *†* +|`string` |The column to subdivide -|expression* (Alias: `fn`, `function`) -|datatable +|`expression` *** *†* + +Alias: `fn`, `exp`, `function` +|`datatable` |An expression to pass into each resulting data table. -Expressions must return a datatable. Use `as` to turn literals into datatables. +Expressions must return a `datatable`. Use `as` to turn literals into datatables. Multiple expressions must return the same number of rows. If you need to return a differing row count, pipe into another instance of `ply`. If multiple expressions return the same columns, the last one wins. |=== -*Returns:* datatable +*Returns:* `datatable` + +[float] +[[progress_fn]] +=== `progress` + +Configure a progress element + +*Accepts:* `number` + +[cols="3*^<"] +|=== +|Argument |Type |Description + +|`barColor` +|`string` +|Color of the background bar + +Default: `"#f0f0f0"` + +|`barWeight` +|`number` +|Thickness of the background bar + +Default: `20` + +|`font` +|`style` +|Font settings for the label. Technically you can stick other styles in here too + +Default: `{<> size=24 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align=center}` + +|`label` +|`boolean`, `string` +|Set `true`/`false` to show/hide label or provide a string to display as the label + +Default: `true` + +|`max` +|`number` +|Maximum value of the progress element + +Default: `1` + +|`shape` +|`string` +|Select {list}, or {end}`, + values: { + list: Object.values(Shape) + .slice(0, -1) + .join(', '), + end: Object.values(Shape).slice(-1)[0], + }, + +Default: `"gauge"` + +|`valueColor` +|`string` +|Color of the progress bar + +Default: `"#1785b0"` + +|`valueWeight` +|`number` +|Thickness of the progress bar + +Default: `20` +|=== + +*Returns:* `render` [float] -=== render +[[render_fn]] +=== `render` Renders an input as a specific element and sets element level options, such as styling. -*Accepts:* render +*Accepts:* `render` [cols="3*^<"] |=== |Argument |Type |Description -|as -|string +|`as` +|`string` |The element type to use in rendering. You might want to use a -specialized function instead, such as `plot` or `grid`. +specialized function instead, such as `<>` or `debug`. + +|`css` +|`string` +|Any block of custom CSS to be scoped to this element -|css -|string -|Any block of custom CSS to be scoped to this element (default is `"* > * {}"`) +Default: `".canvasRenderEl{\n\n}"` -|containerStyle -|containerStyle +|`containerStyle` +|`containerStyle` |Style for the container, including background, border, and opacity + +Default: `{<>}` |=== -*Returns:* render +*Returns:* `render` [float] -=== repeatImage +[[repeatImage_fn]] +=== `repeatImage` Configures a repeating image element. -*Accepts:* number +*Accepts:* `number` [cols="3*^<"] |=== |Argument |Type |Description -|image -|string +|`image` +|`string` |An image asset can be provided as a base64 dataurl, or passed in as a subexpression (see example below) -|size -|number -|default: `100` +|`size` +|`number` +|The maximum height or width of the image, in pixels. Eg, if you images is taller than it is wide, this will limit its height + +Default: `100` + +|`max` +|`number` +|Maximum number of times the image may repeat -|max -|number -|default: `100` +Default: `100` -|emptyImage -|string -|default: `null` +|`emptyImage` +|`string` +|Fill the difference between the input and the `max` parameter with this image + +Default: `null` |=== @@ -1021,64 +1265,76 @@ Example value for the `image` argument, formatted as a base64 data URL: data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E ------------ -*Returns:* render +*Returns:* `render` [float] -=== replace +[[replace_fn]] +=== `replace` Uses a regular expression to replace parts of a string. -*Accepts:* string +*Accepts:* `string` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Aliases: `pattern`, `regex`) -|string +|_Unnamed_ *** + +Alias: `pattern`, `regex` +|`string` |The text or pattern of a JavaScript regular expression, for example, `"[aeiou]"`. You can use capture groups here. -|flags (Alias: `modifiers`) -|datatable +|`flags` + +Alias: `modifiers` +|`datatable` |Specify flags. See the https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp[RegExp documentation] -for reference (default: `g`). +for reference + +Default: `"g"` + +|`replacement` +|`string` +|The replacement for the matching parts of `string`. Capture groups can be accessed +by their index, for example $1 -|replacement -|string -|The replacement for the matching parts of string. Capture groups can be accessed -by their index, for example $1 (default: `""`). +Default: `""` |=== -*Returns:* string +*Returns:* `string` [float] -=== revealImage +[[revealImage_fn]] +=== `revealImage` Configures an image reveal element. -*Accepts:* number +*Accepts:* `number` [cols="3*^<"] |=== |Argument |Type |Description -|image -|string -|An image asset can be provided as a base64 dataurl, or passed in as a subexpression +|`image` +|`string` +|The image to reveal. An image asset can be provided as a base64 dataurl, or passed in as a subexpression (see example below) -|emptyImage -|string -|default: `null` +|`emptyImage` +|`string` +|An optional background image to reveal over -|origin -|string -|default: `bottom` +|`origin` +|`string` +|Where to start from, eg `top`, `left`, `bottom`, or `right` + +Default: `"bottom"` |=== @@ -1088,334 +1344,386 @@ Example value for the `image` argument, formatted as a base64 data URL: data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%0A%3Csvg%20viewBox%3D%22-3.948730230331421%20-1.7549896240234375%20245.25946044921875%20241.40370178222656%22%20width%3D%22245.25946044921875%22%20height%3D%22241.40370178222656%22%20style%3D%22enable-background%3Anew%200%200%20686.2%20235.7%3B%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cdefs%3E%0A%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%0A%09.st0%7Bfill%3A%232D2D2D%3B%7D%0A%3C%2Fstyle%3E%0A%20%20%3C%2Fdefs%3E%0A%20%20%3Cg%20transform%3D%22matrix%281%2C%200%2C%200%2C%201%2C%200%2C%200%29%22%3E%0A%20%20%20%20%3Cg%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M329.4%2C160.3l4.7-0.5l0.3%2C9.6c-12.4%2C1.7-23%2C2.6-31.8%2C2.6c-11.7%2C0-20-3.4-24.9-10.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-4.9-6.8-7.3-17.4-7.3-31.7c0-28.6%2C11.4-42.9%2C34.1-42.9c11%2C0%2C19.2%2C3.1%2C24.6%2C9.2c5.4%2C6.1%2C8.1%2C15.8%2C8.1%2C28.9l-0.7%2C9.3h-53.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0%2C9%2C1.6%2C15.7%2C4.9%2C20c3.3%2C4.3%2C8.9%2C6.5%2C17%2C6.5C312.8%2C161.2%2C321.1%2C160.9%2C329.4%2C160.3z%20M325%2C124.9c0-10-1.6-17.1-4.8-21.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.2-4.1-8.4-6.2-15.6-6.2c-7.2%2C0-12.7%2C2.2-16.3%2C6.5c-3.6%2C4.3-5.5%2C11.3-5.6%2C20.9H325z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M354.3%2C171.4V64h12.2v107.4H354.3z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M443.5%2C113.5v41.1c0%2C4.1%2C10.1%2C3.9%2C10.1%2C3.9l-0.6%2C10.8c-8.6%2C0-15.7%2C0.7-20-3.4c-9.8%2C4.3-19.5%2C6.1-29.3%2C6.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.5%2C0-13.2-2.1-17.1-6.4c-3.9-4.2-5.9-10.3-5.9-18.3c0-7.9%2C2-13.8%2C6-17.5c4-3.7%2C10.3-6.1%2C18.9-6.9l25.6-2.4v-7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc0-5.5-1.2-9.5-3.6-11.9c-2.4-2.4-5.7-3.6-9.8-3.6l-32.1%2C0V87.2h31.3c9.2%2C0%2C15.9%2C2.1%2C20.1%2C6.4C441.4%2C97.8%2C443.5%2C104.5%2C443.5%2C113.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bz%20M393.3%2C146.7c0%2C10%2C4.1%2C15%2C12.4%2C15c7.4%2C0%2C14.7-1.2%2C21.8-3.7l3.7-1.3v-26.9l-24.1%2C2.3c-4.9%2C0.4-8.4%2C1.8-10.6%2C4.2%26%2310%3B%26%239%3B%26%239%3B%26%239%3BC394.4%2C138.7%2C393.3%2C142.2%2C393.3%2C146.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M491.2%2C98.2c-11.8%2C0-17.8%2C4.1-17.8%2C12.4c0%2C3.8%2C1.4%2C6.5%2C4.1%2C8.1c2.7%2C1.6%2C8.9%2C3.2%2C18.6%2C4.9%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc9.7%2C1.7%2C16.5%2C4%2C20.5%2C7.1c4%2C3%2C6%2C8.7%2C6%2C17.1c0%2C8.4-2.7%2C14.5-8.1%2C18.4c-5.4%2C3.9-13.2%2C5.9-23.6%2C5.9c-6.7%2C0-29.2-2.5-29.2-2.5%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bl0.7-10.6c12.9%2C1.2%2C22.3%2C2.2%2C28.6%2C2.2c6.3%2C0%2C11.1-1%2C14.4-3c3.3-2%2C5-5.4%2C5-10.1c0-4.7-1.4-7.9-4.2-9.6c-2.8-1.7-9-3.3-18.6-4.8%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-9.6-1.5-16.4-3.7-20.4-6.7c-4-2.9-6-8.4-6-16.3c0-7.9%2C2.8-13.8%2C8.4-17.6c5.6-3.8%2C12.6-5.7%2C20.9-5.7c6.6%2C0%2C29.6%2C1.7%2C29.6%2C1.7%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bv10.7C508.1%2C99%2C498.2%2C98.2%2C491.2%2C98.2z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M581.7%2C99.5h-25.9v39c0%2C9.3%2C0.7%2C15.5%2C2%2C18.4c1.4%2C2.9%2C4.6%2C4.4%2C9.7%2C4.4l14.5-1l0.8%2C10.1%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-7.3%2C1.2-12.8%2C1.8-16.6%2C1.8c-8.5%2C0-14.3-2.1-17.6-6.2c-3.3-4.1-4.9-12-4.9-23.6V99.5h-11.6V88.9h11.6V63.9h12.1v24.9h25.9V99.5z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M598.7%2C78.4V64.3h12.2v14.2H598.7z%20M598.7%2C171.4V88.9h12.2v82.5H598.7z%22%2F%3E%0A%20%20%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M663.8%2C87.2c3.6%2C0%2C9.7%2C0.7%2C18.3%2C2l3.9%2C0.5l-0.5%2C9.9c-8.7-1-15.1-1.5-19.2-1.5c-9.2%2C0-15.5%2C2.2-18.8%2C6.6%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-3.3%2C4.4-5%2C12.6-5%2C24.5c0%2C11.9%2C1.5%2C20.2%2C4.6%2C24.9c3.1%2C4.7%2C9.5%2C7%2C19.3%2C7l19.2-1.5l0.5%2C10.1c-10.1%2C1.5-17.7%2C2.3-22.7%2C2.3%26%2310%3B%26%239%3B%26%239%3B%26%239%3Bc-12.7%2C0-21.5-3.3-26.3-9.8c-4.8-6.5-7.3-17.5-7.3-33c0-15.5%2C2.6-26.4%2C7.8-32.6C643%2C90.4%2C651.7%2C87.2%2C663.8%2C87.2z%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cpath%20class%3D%22st0%22%20d%3D%22M236.6%2C123.5c0-19.8-12.3-37.2-30.8-43.9c0.8-4.2%2C1.2-8.4%2C1.2-12.7C207%2C30%2C177%2C0%2C140.2%2C0%26%2310%3B%26%239%3B%26%239%3BC118.6%2C0%2C98.6%2C10.3%2C86%2C27.7c-6.2-4.8-13.8-7.4-21.7-7.4c-19.6%2C0-35.5%2C15.9-35.5%2C35.5c0%2C4.3%2C0.8%2C8.5%2C2.2%2C12.4%26%2310%3B%26%239%3B%26%239%3BC12.6%2C74.8%2C0%2C92.5%2C0%2C112.2c0%2C19.9%2C12.4%2C37.3%2C30.9%2C44c-0.8%2C4.1-1.2%2C8.4-1.2%2C12.7c0%2C36.8%2C29.9%2C66.7%2C66.7%2C66.7%26%2310%3B%26%239%3B%26%239%3Bc21.6%2C0%2C41.6-10.4%2C54.1-27.8c6.2%2C4.9%2C13.8%2C7.6%2C21.7%2C7.6c19.6%2C0%2C35.5-15.9%2C35.5-35.5c0-4.3-0.8-8.5-2.2-12.4%26%2310%3B%26%239%3B%26%239%3BC223.9%2C160.9%2C236.6%2C143.2%2C236.6%2C123.5z%20M91.6%2C34.8c10.9-15.9%2C28.9-25.4%2C48.1-25.4c32.2%2C0%2C58.4%2C26.2%2C58.4%2C58.4%26%2310%3B%26%239%3B%26%239%3Bc0%2C3.9-0.4%2C7.7-1.1%2C11.5l-52.2%2C45.8L93%2C101.5L82.9%2C79.9L91.6%2C34.8z%20M65.4%2C29c6.2%2C0%2C12.1%2C2%2C17%2C5.7l-7.8%2C40.3l-35.5-8.4%26%2310%3B%26%239%3B%26%239%3Bc-1.1-3.1-1.7-6.3-1.7-9.7C37.4%2C41.6%2C49.9%2C29%2C65.4%2C29z%20M9.1%2C112.3c0-16.7%2C11-31.9%2C26.9-37.2L75%2C84.4l9.1%2C19.5l-49.8%2C45%26%2310%3B%26%239%3B%26%239%3BC19.2%2C143.1%2C9.1%2C128.6%2C9.1%2C112.3z%20M145.2%2C200.9c-10.9%2C16.1-29%2C25.6-48.4%2C25.6c-32.3%2C0-58.6-26.3-58.6-58.5c0-4%2C0.4-7.9%2C1.1-11.7%26%2310%3B%26%239%3B%26%239%3Bl50.9-46l52%2C23.7l11.5%2C22L145.2%2C200.9z%20M171.2%2C206.6c-6.1%2C0-12-2-16.9-5.8l7.7-40.2l35.4%2C8.3c1.1%2C3.1%2C1.7%2C6.3%2C1.7%2C9.7%26%2310%3B%26%239%3B%26%239%3BC199.2%2C194.1%2C186.6%2C206.6%2C171.2%2C206.6z%20M200.5%2C160.5l-39-9.1l-10.4-19.8l51-44.7c15.1%2C5.7%2C25.2%2C20.2%2C25.2%2C36.5%26%2310%3B%26%239%3B%26%239%3BC227.4%2C140.1%2C216.4%2C155.3%2C200.5%2C160.5z%22%2F%3E%0A%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E ------------ -*Returns:* render +*Returns:* `render` [float] -=== rounddate +[[rounddate_fn]] +=== `rounddate` -Rounds milliseconds since epoch using a Moment.js formatting string; returns +Rounds milliseconds since epoch using a MomentJS formatting string and returns milliseconds since epoch. -*Accepts:* number +*Accepts:* `number` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string -|Moment.js Format with which to bucket. See the +|_Unnamed_ + +Alias: `format` +|`string` +|MomentJS Format with which to bucket. See the https://momentjs.com/docs/#/displaying/[MomentJS documentation]. -For example, "YYYY-MM" rounds to the month. +For example, `"YYYY-MM"` rounds to the month. |=== -*Returns:* number +*Returns:* `number` [float] -=== rowCount +[[rowCount_fn]] +=== `rowCount` -Returns the number of rows. Pairs with `ply` to get the count of unique column +Returns the number of rows. Pairs with `<>` to get the count of unique column values, or combinations of unique column values. -*Accepts:* datatable +*Accepts:* `datatable` -*Returns:* number +*Returns:* `number` [float] -=== seriesStyle +[[seriesStyle_fn]] +=== `seriesStyle` Creates an object used for describing the properties of a series on a chart. You typically use this inside of a charting function. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|label* -|string +|`label` +|`string` |The label of the line this style applies to, not the name you would like to give the line. -|color -|string +|`color` +|`string` |The color to assign the line -|lines -|number -|The width of the line (default: `0`) +|`lines` +|`number` +|The width of the line -|bars -|number -|The width of bars (default: `0`) +|`bars` +|`number` +|The width of bars -|points -|number -|The size of points on line (default: `5`) +|`points` +|`number` +|The size of points on line -|fill -|number, boolean -|Designates if points should be filled (default: `false`) +|`fill` +|`number`, `boolean` +|Designates if points should be filled -|stack -|number -|Designates if the series should be stacked? This number is the stack "id"; series -with the same stack id are stacked together. +Default: `false` -|horizontalBars -|boolean -|Sets the orientation of bars in the chart to horizontal (default: `false`) +|`stack` +|`number`, `null` +|Designates if the series should be stacked? This number is the stack "id". Series with the same stack id are stacked together. + +|`horizontalBars` +|`boolean` +|Sets the orientation of bars in the chart to horizontal + +Default: `false` |=== -*Returns:* Depends on your input and arguments +*Returns:* `seriesStyle` [float] -=== shape +[[shape_fn]] +=== `shape` Creates a shape. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ (Alias: `shape`) -|string -|Pick a shape (default: `square`) +|_Unnamed_ + +Alias: `shape` +|`string` +|Pick a shape + +Default: `"square"` -|fill -|string -|Valid CSS color string (default: `black`) +|`fill` +|`string` +|Valid CSS color string -|border (Alias `stroke`) -|number +Default: `"black"` + +|`border` + +Alias `stroke` +|`number` |Valid CSS color string -|borderWidth (Alias: `strokeWidth`) -|number -|Thickness of the border (default: `0`) +|`borderWidth` + +Alias: `strokeWidth` +|`number` +|Thickness of the border -|maintainAspect -|boolean -|Select `true` to maintain aspect ratio (default: `false`) +Default: `0` + +|`maintainAspect` +|`boolean` +|Select `true` to maintain aspect ratio + +Default: `false` |=== *Returns:* shape [float] -=== sort +[[sort_fn]] +=== `sort` -Sorts a datatable on a column. +Sorts a `datatable on a column.` -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Alias: `column`) -|string -|The column to sort on. If column is not specified, the datatable is sorted on +|_Unnamed_ + +Alias: `column` +|`string` +|The column to sort on. If column is not specified, the `datatable` is sorted on the first column. -|reverse* -|boolean -|Reverse the sort order. If reverse is not specified, the datatable is sorted -in ascending order. +|`reverse` +|`boolean` +|Reverse the sort order. If reverse is not specified, the `datatable` is sorted in ascending order. + +Default: `false` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== staticColumn +[[staticColumn_fn]] +=== `staticColumn` -Adds a column with a static value. +Adds a column with a static value. See also <> and <>. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Alias: `column`) -|string +|_Unnamed_ *** + +Alias: `column`, `name` +|`string` |The name of the new column -|value -|string, number, boolean -|The value to insert in each column (default: is `null`). Tip: Use a sub-expression -to rollup other columns into a static value. +|`value` +|`string`, `number`, `boolean`, `null` +|The value to insert in each column. Tip: Use a sub-expression to rollup other columns into a static value. + +Default: `null` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== string +[[string_fn]] +=== `string` Outputs a string made of other strings. Mostly useful when combined with -sub-expressions that output a string, or something castable to a string. +sub-expressions that output a string, or something castable to `string`. -*Accepts:* Anything or nothing +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|string -|One or more strings to join together; include spaces where needed +|_Unnamed_ *** *†* + +Alias: `value` +|`string` +|One or more `strings` to join together, include spaces where needed |=== -*Returns:* string +*Returns:* `string` [float] -=== switch +[[switch_fn]] +=== `switch` -Performs conditional logic with multiple conditions. See also the case function, -which builds a case to pass to the switch function. +Performs conditional logic with multiple conditions. See also <>, +which builds a `case` to pass to the <> function. -*Accepts:* Anything or nothing +*Accepts:* `any` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* (Alias: `case`) -|case -|The list of conditions to check +|_Unnamed_ *** *†* -|default (Alias: `finally`) -|any -|The default case, if no cases match +Alias: `case` +|`case` +|The list of conditions to check. See <> + +|`default` + +Alias: `finally` +|`any` +|The default returned value, if no cases match |=== *Returns:* Depends on your input and arguments [float] -=== table +[[table_fn]] +=== `table` Configures a data table element. -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|font -|style -|Font style (default: `{font}`) +|`font` +|`style` +|Font style + +Default: `{<>}` + +|`paginate` +|`boolean` +|Show pagination controls. If set to `false` only the first +page is displayed. + +Default: `true` + +|`perPage` +|`number` +|Show this many rows per page -|paginate -|boolean -|Show pagination controls (default: `true`). If set to `false` only the first -page is displayed. +Default: `10` -|perPage -|number -|Show this many rows per page (default: `10`) +|`showHeader` +|`boolean` +|Show or hide the header row with titles for each column -|showHeader -|boolean -|Show or hide the header row with titles for each column (default: `true`) +Default: `true` |=== -*Returns:* render +*Returns:* `render` [float] -=== tail +[[tail_fn]] +=== `tail` -Gets the last N rows from the end of a datatable. See also, `head`. +Gets the last N rows from the end of a `datatable`. See also <> -*Accepts:* datatable +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_* -|case -|Return this many rows from the end of the datatable +|_Unnamed_ *** + +Alias: `count` +|`number` +|Return this many rows from the end of the `datatable` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== timefilter +[[timefilter_fn]] +=== `timefilter` Creates a time filter for querying a source. -*Accepts:* filter +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|column (Aliases: `field`, `c`) -|any -|The column or field to attach the filter to (default: `@timestamp`) +|`column` + +Alias: `field`, `c` +|`string` +|The column or field to attach the filter to + +Default: `"@timestamp"` + +|`from` + +Alias: `f`, `start` +|`string` +|Beginning of the range, in ISO8601 or {es} `datemath` format -|from (Aliases: `f`, `start`) -|string -|Beginning of the range, in ISO8601 or {es} datemath format +|`to` -|to (Aliases: `t`, `end`) -|string -|End of the range, in ISO8601 or {es} datemath format +Alias: `t`, `end` +|`string` +|End of the range, in ISO8601 or {es} `datemath` format |=== -*Returns:* filter +*Returns:* `filter` [float] -=== timefilterControl +[[timefilterControl_fn]] +=== `timefilterControl` Configures a time filter control element. -*Accepts:* null +*Accepts:* `null` [cols="3*^<"] |=== |Argument |Type |Description -|column (Aliases: `field`, `c`) -|any -|The column or field to attach the filter to - -|compact -|any -|Show the time filter as a button that triggers a popover (default: `true`) -|=== - -*Returns:* render - +|`column` -[float] -=== to +Alias: `field`, `c` +|`string` +|The column or field to attach the filter to -Explicitly casts from one type to another. +Default: `"@timestamp"` -*Accepts:* Anything or nothing +|`compact` +|`boolean` +|Show the time filter as a button that triggers a popover -[cols="3*^<"] -|=== -|Argument |Type |Description +Default: `true` -|_Unnamed_* (Alias: `type`) -|string -|A known type +|`filterGroup` +|`string` +|Group name for the filter |=== -*Returns:* Depends on your input and arguments +*Returns:* `render` \ No newline at end of file diff --git a/docs/canvas/canvas-server-functions.asciidoc b/docs/canvas/canvas-server-functions.asciidoc index b765476898b3e..43bc7fdd256f1 100644 --- a/docs/canvas/canvas-server-functions.asciidoc +++ b/docs/canvas/canvas-server-functions.asciidoc @@ -9,191 +9,177 @@ the server when it hits one of these functions. A *** denotes a required argument. +A *†* denotes an argument can be passed multiple times. + [float] -=== demodata +[[demodata_fn]] +=== `demodata` A mock data set that includes project CI times with usernames, countries, and run phases. -*Accepts:* filter +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ (Alias: `type`) -|string -|The name of the demo data set to use (default: `ci`) +|_Unnamed_ + +Alias: `type` +|`string` +|The name of the demo data set to use + +Default: `"ci"` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== esdocs +[[escount_fn]] +=== `escount` -Queries {es} and gets back raw documents. Specify the fields you want to receive, -especially if you are asking for a lot of rows. +Queries {es} for a count of the `number` of hits matching a query. -*Accepts:* filter +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|index -|string -|Specify an index pattern, for example, "logstash-*" (default is `_all`) +|_Unnamed_ -|_Unnamed_ (Aliases: `query`, `q`) -|string -|A Lucene query string (default: `_index:.kibana`) +Alias: `q`, `query` +|`string` +|A Lucene query `string` -|sort -|string -|Sort directions as "field, direction", for example, "@timestamp, desc" or "bytes, asc" +Default: `"-_index:.kibana"` -|fields -|string -|Comma separated list of fields. Fewer fields will perform better +|`index` +|`string` +|Specify an index pattern, for example, "logstash-*" -|metaFields -|string -|Comma separated list of meta fields, for example, "_index,_type" - -|count -|number -|The number of docs to pull back. Smaller numbers perform better (default: `100`) +Default: `all` |=== -*Returns:* datatable +*Returns:* `number` [float] -=== escount +[[esdocs_fn]] +=== `esdocs` -Queries {es} for a count of the number of hits matching a query. +Queries {es} and gets back raw documents. Specify the fields you want to receive, +especially if you are asking for a lot of rows. -*Accepts:* filter +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|index -|string -|Specify an index pattern, for example, "logstash-*" (default: `all`) +|_Unnamed_ -|_Unnamed_ (Alias: `query`, `q`) -|string -|A Lucene query string (default: `"-_index:.kibana"`) -|=== +Aliases: `q`, `query` +|`string` +|A Lucene query string -*Returns:* number +Default: `"-_index:.kibana"` -[float] -=== essql +|`index` +|`string` +|Specify an index pattern, for example, `"logstash-*"` -Specifies an {es} SQL. +Default: `"_all"` -*Accepts:* filter -[cols="3*^<"] -|=== -|Argument |Type |Description +|`sort` +|`string` +|Sort directions as `"field, direction"`, for example, `"@timestamp, desc"` or `"bytes, asc"` + +|`fields` +|`string` +|Comma separated list of fields. Fewer fields will perform better -|_Unnamed_* (Alias: `query`, `q`) -|string -|An SQL query +|`metaFields` +|`string` +|Comma separated list of meta fields, for example, `"_index,_type"` -|count -|number -|The default is `1000` +|`count` +|`number` +|The number of docs to pull back. Smaller numbers perform better + +Default: `100` |=== -*Returns:* datatable +*Returns:* `datatable` [float] -=== pointseries +[[essql_fn]] +=== `essql` -Turns a datatable into a point series model. Currently Canvas differentiates measure -from dimensions by looking for a <>. If you enter a TinyMath -expression in your argument, Canvas treats that argument as a measure. Otherwise, it -is a dimension. Dimensions are combined to create unique keys. Measures are -then deduplicated by those keys using the specified TinyMath function. +Specifies an {es} SQL. -*Accepts:* datatable +*Accepts:* `filter` [cols="3*^<"] |=== |Argument |Type |Description -|x -|string -|The values along the X-axis - -|y -|string -|The values along the Y-axis +|_Unnamed_ *** -|color -|string -|An expression to use in determining the mark's color +Alias: `q`, `query` +|`string` +|An {es} SQL query -|size -|string -|For elements that support it, the size of the marks +|`count` +|`number` +|The number of documents to retrieve -|text -|string -|For use in charts that support it, the text to show in the mark +Default: `1000` |=== -*Returns:* pointseries +*Returns:* `datatable` [float] -=== server - -Forces the interpreter to return to the server. - -*Accepts:* Anything or nothing +[[pointseries_fn]] +=== `pointseries` -*Returns:* Depends on your input and arguments -  - -[float] -=== timelion - -Uses Timelion to extract one or more time series from many sources. +Turns a `datatable` into a point series model. Currently Canvas differentiates measure +from dimensions by looking for a <>. If you enter a TinyMath +expression in your argument, Canvas treats that argument as a measure. Otherwise, it +is a dimension. Dimensions are combined to create unique keys. Measures are +then deduplicated by those keys using the specified TinyMath function. -*Accepts:* filter +*Accepts:* `datatable` [cols="3*^<"] |=== |Argument |Type |Description -|_Unnamed_ (Aliases: `query`, `q`) -|string -|A Timelion query (default: `".es(*)"`) +|`x` +|`string` +|The values along the X-axis -|interval -|string -|Bucket interval for the time series (default: `auto`) +|`y` +|`string` +|The values along the Y-axis -|from -|any -|{es} date math string for the start of the time range (default: `now-1y`) +|`color` +|`string` +|An expression to use in determining the mark's color -|to -|any -|{es} date math string for the end of the time range (default: `now`) +|`size` +|`string` +|For elements that support it, the size of the marks -|timezone -|any -|Time zone for the time range (default: `UTC`) +|`text` +|`string` +|For use in charts that support it, the text to show in the mark |=== -*Returns:* datatable +*Returns:* `pointseries`