Conditionally displaying comments on a plot


There are times when you may want to conditionally label points on a graph.  For example, let's say you have sales data, and a small percentage of these records have a comment.  You may want to display the comment as a label on a chart, and display no label for the records with no comments.

The first step to implement this is to create a calculated column which will output 'yes' if you have a comment for that row , otherwise 'no'.  Assuming our comment column is called 'Comments', the expression is shown below:




Next, we should update our plot to show a label by the 'Comments' column and only show labels for marked records.

 



Once this is done, we now need to create two bookmarks: one with all the comment records marked and another with none marked.  

The easiest way to do this is to create a Cross Table which displays just the 'Comment Flag' column we created earlier on the vertical axis and 'Row Count' on the bottom axis.

 



Next, mark the 'yes' row in the Cross Table and then click the 'Capture Bookmark' icon in the toolbar and save the bookmark as 'Show Comments'.  Then unmark all records and click 'Capture Bookmark' this time saving the bookmark as 'Hide Comments'.

The last step is to open up a Text Area and add two Action Control buttons. The first is called 'Show Comments' and will include the Marking selection from the 'Show Comments' bookmark and the second is called 'Hide Comments' and will include the Marking selection from the 'Hide Comments' bookmark.

 


 

NOTE: The reason we create the calculated column and display the cross table is so that it is easier to mark all records with comments so we can bookmark it. You can always show the comments in a table chart as well and mark them that way, so that no calculated column has to be created.

You can then delete the Cross Table, and the finished product will have two buttons to show and hide the comments as labels on the given chart.