Work with Comments in Analytic Applications

At application runtime you can view and create comments on a widget or table cell from both analytic and planning models. At design time you can leverage script APIs to allow for more actions about comments. Commenting is available in both stories and analytic applications. Only the specifics in the analytics designer are described here.

You can add comments to the following widgets in analytic applications:

  • chart

  • table

  • geo map

  • image

  • shape

  • text

  • RSS reader

  • web page

  • R visualization

  • clock

Note

First, to enable commenting for a widget, at design time go to the Quick Menus section of its Styling panel and select Comment.

Note

If you create a story from an analytic application, comments won’t be carried to the story.

Add Comments

For how to add comments to a table cell, refer to Adding Comments to a Data Cell.

To add comments to a widget, from the context menu select Start of the navigation pathAdd Next navigation step End of the navigation pathComment.

Show or Hide Comments

In the view time mode (after selecting Exit Fullscreen), you can directly show or hide all comments by selecting Comment Mode under Display in the toolbar.

If your application is in embedded mode, you need to first switch on Commenting in Embedded Mode via Start of the navigation path System Next navigation step  Administration Next navigation step System ConfigurationEnd of the navigation path. Then you can leverage the following API to show or hide comments:

Code Syntax
Application.setCommentModeEnabled(isEnabled:bool)

Get, Post or Remove Table Cell Comments

In addition to directly creating or removing comments in an analytic application as in a story, you can leverage scripts APIs to enable getting, posting or removing comments on a table cell either based on comment IDs or the data context.

Example
For example, you’ve created an input field InputField_1 and would like to allow application users to:
  1. Select Button_1 to get the comment on one table cell and fill it into the input field.

  2. Select Button_2 and post the comment in the input field to any selected table cell.

First write the following script for Button_1:

Sample Code
var comments = Table_1.getDataSource().getComments().getAllComments(Table_1.getSelections()[0]);
console.log(comments);
var str = "";
for(var i = 0 ; i < comments.length; i ++){
	var text = comments[i].text;
	str = str + txt;
}
InputField_1.setValue(str);

Then write the following script for Button_2:

Sample Code
var str = InputField_1.getValue();
Table_1.getDataSource().getComments().addComment(Table_1.getSelections()[0],str);