Jump to content

How to display the current number of selected data points in vizualizations in WebPlayer

Georgi Koemdzhiev

Recommended Posts

Hello, I am trying to figure out if there is a way to show the number of marked (i.e. selected) data points in a visualization (.e.g Map chart) on the WebPlayer. For example, if I mark some data points on a Map chart, I would like to know how many I have marked using the selection tool (e.g. Lasso).


Is there any build-in setting that I can enable to show that kind of information on the WebPlayer If there is no such option



I was looking at scripting to achieve similar functionality. For example, using a _TextArea_ that have a Button and a Label, when the button is pressed it executes the following script:

#count number of rows


#total row count

myTable = Document.ActiveDataTableReference

total = myTable.RowCount


#filtered rows

visible = Document.ActiveMarkingSelectionReference.GetSelection(myTable).IncludedRowCount


#excluded rows

filtered = total - visible



print myTable.Name," total: ",total," visible:",visible, " filtered:",filteredThe problem with the above is that it always shows "0"s.


EDIT: When I executed that on an analysis document that has a "embedded" data it worked fine. I am trying to count the marked rows in analysis document that get's it's data from an "External" data source (i.e. SQL server)

Link to comment
Share on other sites

Yup, that would bethe reason why you do not see any output. You cannot get the marking details when the data table is external.

If you need to get the selected rows you can try 1 of the below,

1. Import the data table

2. Keep this data table external and add a new imported On-demand data table which loads the marked data. Run the IronPython script on this Ondemand data table to find the row count


Link to comment
Share on other sites

Thank you very much for the swift response! I will look into adding a On-Demand data table method you suggested as I need to display to the user the number of selected rows. Thanks a lot! 


P.S.: Is there a way to "hook" into the "on-select" event so that I can execute that IronPython script every time the user marks something on a visualization  

Link to comment
Share on other sites

I tried this with External data (Microsoft SQL), and it worked for me:

In the Analyst client:


From the map chart, select the data points of interest (using Lasso or other means)

Right-click and select Create Details Visualization -> Cross Table.

Configure the cross table to show Row Count as the measure, and None on both the X and Y axes.

Then, many of the visible things in the cross table can be removed (the legend can be hidden, the title bar can be hidden, the axis selectors can be hidden, the cell values expression can be set to "count() as []" rather than just "count()" for example to hide the measure name).


Save the analysis to the library and open it in the web player. The update of the Count in the cross table still works fine.

(I know this isn't in a Text area, but it may be good enough in some cases.)

If you want something more complicated, such as UniqueCount of some ID or other column (say, if you want to show the number of cities or stores that you have marked but each row represented a transaction), then that is simple to accomplish by just changing Count() to UniqueCount(column).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...