Use Text Widgets in Analytic Applications
You add the text widget to your analytic application to enter text or apply dynamic text to it.
The text widget is used in both stories and analytic applications. Only the properties specific for the analytics designer are listed here.
To add a text widget, from the toolbar select
.You can't add emojis to texts.
Define Source of Dynamic Text
- Analytic Application Properties
- Input Controls
- Tile Filters & Variables
- Model Variables
Dynamic text with team signature as source isn't supported.
For how to add dynamic text and more information, see Add Dynamic Text to a Story.
In addition, you can choose Script Variables as the source of dynamic text.
At runtime, the global variables will change according to the customized scripts, and their values will be automatically updated in the text widget.
Use APIs to Get, Apply Text and Handle Line Breaks
You can use getPlainText() API to get the text with line breaks kept and applyText() API to change the text in the text widget. You can use \n in the applyText() API to add line breaks in the text widget.
In this example, when the application user clicks on the button at runtime, a new line This is a new paragraph. appears under the current text in the text widget Text_1.
To achieve this, write the following script in the button's onClick event:
var currentText = Text_1.getPlainText(); Text_1.applyText(currentText + "\nThis is a new paragraph.");
Before:
After: