Compose Text Dialog
Learn how to compose custom text formats for chart labels and tooltips using the Compose Text dialog. Combine plain text, data values, rich text styles, and HTML formatting with a simple syntax.
The Compose Text dialog lets you define how text is displayed for chart items, axis labels, legend labels, geo map labels, and tooltips. You can combine plain text, data values, rich text styles, images, and HTML formatting using a simple syntax.
Overview
The Compose Text dialog is available on fields that control label or tooltip formatting across your chart:
| Context | Purpose |
|---|---|
| Chart item labels | Display item name, value, or both |
| Axis labels | Format axis tick values |
| Legend labels | Customize legend text |
| Geo map labels | Show region names |
| Tooltips (item hover) | Format tooltip content when hovering a data item |
| Tooltips (axis hover) | Format tooltip content when hovering an axis position (multi-series) |
The button to open the dialog reads Compose Text or Compose Text / Styles / Images when rich text or images are available for insertion. The button's background color indicates whether formatting is active, white means the no text is currently defined. The dialog opens as a draggable, resizable window.
The Editor
The main code editor is where you write your format string. It uses syntax highlighting to help you read and write expressions:
| Color | Meaning |
|---|---|
| Purple | Data expressions inside curly braces |
| Orange | Rich text style tokens (e.g. {styleName|...}) |
| Green | Plain text and quoted strings |
| Blue | HTML elements (tooltip context only) |
Inserting Data
The Insert Data section shows clickable chips that insert data references into the editor. The available chips depend on the context:
Chart labels (single dimension)
| Chip | Inserts | Description |
|---|---|---|
| Name | {item.name} | The item's name |
| Value | {item.value} | The item's value |
Chart labels (multiple dimensions)
| Chip | Inserts | Description |
|---|---|---|
| 1. field name 1 | {1} | Value from the first data field |
| 2. field name 2 | {2} | Value from the second data field |
| ... | ... | and so on |
Axis labels
| Chip | Inserts | Description |
|---|---|---|
| item | {item} | The axis tick value |
Legend labels
| Chip | Inserts | Description |
|---|---|---|
| item | {item} | The legend item name |
Geo map labels
| Chip | Inserts | Description |
|---|---|---|
| name | {item.name} | The region name |
Tooltip — item hover
| Chip | Inserts | Description |
|---|---|---|
| 1. field name 1 | {1} | Value from the first data field |
| 2. field name 2 | {2} | Value from the second data field |
| ... | ... | and so on |
Tooltip — axis hover (multi-series)
Use the dropdowns to select a picta (chart series) and a data field, then insert:
| Chip | Inserts | Description |
|---|---|---|
| data value | {item[x].data[y]} | A specific data value |
| field name | {item[x].dimensionNames[y]} | The field name |
| marker | {item[x].marker} | The series color marker |
Here x is the zero-based index of the chart series, and y is the zero-based index of the data field.
Inserting Styles
If you have defined any rich text styles (see the Styles tab), the Insert Style section shows a chip for each style:
styleName → inserts {styleName|..}
Place your cursor where the styled text should go, type or paste the content over the .. placeholders.
Inserting HTML / Line Breaks
For tooltips (full HTML support)
| Chip | Icon | Inserts |
|---|---|---|
| Bold | B | <b>..</b> |
| Italic | I | <i>..</i> |
| Underline | U | <u>..</u> |
| Strikethrough | <s>..</s> | |
| Line break | ↵ | <br/> |
| Table | ▦ | <table>...</table> template |
| Superscript | x² | x<sup>2</sup> |
| Subscript | x₂ | x<sub>2</sub> |
| H-Line | — | <hr/> |
| Small | Sm | <small>..</small> |
| Div | Div | <div>..</div> |
| Span | Span | <span>..</span> |
| Div styled | — | <div style="color:green">green</div> |
| Span styled | — | <span style="color:red">red</span> |
For styled inserts, replace the .. placeholders with your content.
For labels (plain text)
| Chip | Icon | Inserts |
|---|---|---|
| Newline | ↵ | \n |
Explanation Tab
The Explanation tab contains reference material and examples to help you build format strings.
Examples by Context
Each chart context has its own set of examples showing common patterns:
Chart labels (single dimension)
Show the name of the item
{item.name}
Show the value of the item
{item.value}
Show the name and value of the item with text
The {item.name} is {item.value}
Chart labels (multiple dimensions)
Show the value from the first field
{1}
Show text and the value from the first field
Value: {1}
Combine data from the first and third field with text
The {1} is {3} meters
Axis labels
Show the item value
{item}
Show the item value multiplied by 2 with leading text
Double: {item * 2}
Show the item value rounded to two decimals
{round(item * 100) / 100}
Show the item value formatted as a currency with two trailing zeros
{item + (item % 1 == 0 ? ".00" : (item * 10) % 1 == 0 ? "0" : "" )}
Legend labels
Show the item value
{item}
Show the item value with trailing text
{item} legend
Geo map labels
Show the name of the item
{item.name}
Show the name with text
The name is: {item.name}
Tooltip — item hover
<b>Title: </b>{3}
<br/>
<b>Date: </b>{6}
Tooltip — axis hover (multi-series)
<table>
<tr>
<th>{item[0].data[0]}</th>
</tr>
<tr>
<td width="20">{item[0].marker}</td>
<td width="110">{item[0].dimensionNames[1]}</td>
<td width="70">{item[0].data[1]} visits</td>
</tr>
<tr>
<td>{item[1].marker}</td>
<td>{item[1].dimensionNames[2]}</td>
<td>{item[1].data[2]} visits</td>
</tr>
... more rows if more items at this axis position
</table>
Colors Reference
| Color | Usage |
|---|---|
| Purple | Data expressions — place these inside curly braces |
| Orange | Style tokens — place these inside curly braces |
| Green | Plain text — everything outside curly braces |
| Blue | HTML elements — only in tooltip context |
Operators Reference
| Operator | Description |
|---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
^ | Exponentiation (power) |
% | Remainder (modulo) |
Functions Reference
| Function | Description |
|---|---|
round(x) | Rounds x to the nearest integer |
ceil(x) | Ceiling — smallest integer ≥ x |
floor(x) | Floor — largest integer ≤ x |
abs(x) | Absolute value (magnitude) of x |
sqrt(x) | Square root of x (returns NaN if negative) |
log(x) | Natural logarithm (base e) |
exp(x) | Exponential function e^x |
Debugging
If your format string does not work as expected, use {print(item)} inside an expression to output the current value to the browser console.
- Open the console with F12 or Ctrl+Shift+I (Windows/Linux) / Cmd+Option+I (Mac)
- For chart and axis labels: output appears immediately
- For tooltips: hover over chart elements to trigger the output
Note:
{1},{2}, etc. are shorthands for{item.data[0]},{item.data[1]}, and so on. The index is zero-based when using theitem.datasyntax.
Styles Tab
The Styles tab lets you define reusable rich text styles that can be applied to parts of your format string using the {styleName|content} syntax.
Managing Styles
- List — all defined styles are shown as buttons
- Add — click Add Text Style to create a new style (named
style_1,style_2, etc.) - Select — click a style to view and edit its properties
- Remove — click Remove this style to delete the selected style
Live Preview
- Type any text in the Preview text field
- A rendered preview image updates automatically, showing how text would look with the selected style applied
Customization Options
| Property | Description |
|---|---|
| Style name | Referenced in the format string as `{name |
| Background color | Fill color behind the text |
| Width | Box width in pixels |
| Height | Box height in pixels |
| Padding | Inner spacing in pixels |
| Font | Font family, size, weight, color, and style |
| Text border | Border color and width around the text |
| Text shadow | Shadow offset, blur, and color |
| Box border | Border around the entire rich text box |
| Box shadow | Shadow around the rich text box |
| Alignment | Horizontal and vertical alignment |
Images Tab
The Images tab lets you add images (uploaded, emojis, brand logos, or country flags) that can be referenced in your format string using the {imageName} syntax.
Adding Images
| Method | Description |
|---|---|
| Upload Image | Upload your own image file |
| Add Emojis | Browse and select emojis from the OpenMoji library (CC BY-SA 4.0) |
| Add Brand Logos | Browse and select brand icons from SimpleIcons (CC0 1.0) |
| Add Country Flags | Browse and select country flags fetched from FlagCDN |
Image size warning: If your uploaded image exceeds 100 KB, a warning appears suggesting you resize it for optimal performance.
Managing Images
- List — all images are shown as buttons
- Select — click an image to view its preview and properties
- Remove — click Remove this image to delete the selected image
- Remove all — click Remove all images to delete every image at once
Customization Options
| Property | Description |
|---|---|
| Style name | Referenced in the format string as {name} |
| Width | Display width in pixels |
| Height | Display height in pixels |
Preview
The preview area shows the selected image along with its:
- File size (formatted in KB/MB)
- Dimensions (width × height in pixels, for non-SVG images)
