For example, if your Analysis is aimed at people without a solid understanding of the underlying data you might find useful to actually hide Spotfire's filters, axis selectors or other features that could prove "too much powerful" for your intended target.
In this post we will show you how to create an Analysis like that of Figure 01 where you modify a visualization axis using a UI control embedded in a Text Area; if the user selects Total Sales, Total Units Sold or Average Unit Price from the drop down list in the top of the page the Bar Chart at the bottom will change accordingly.
Figure 01 - Sample Guided Analytic |
Figure 02 - Initial Situation |
Figure 03 - Insert Drop Down List Property Control into the Text Area |
Figure 04 - Create New Document Property |
With Fixed values selected the bottom part of the dialog now shows a list where we can just type the Dipslay Name and Value pairs that will fill our Drop Down List. The Display Name is what the user sees in the UI Control while the Value is the actual text that will be stored in the associated Document Property.
We type Total Sales and Sum([store_sales]) in the first row, Total Units Sold and Sum([unit_sales]) in the second row and finally Average Unit Price and Avg([store_sales]/[unit_sales]) in the third, like displayed in Figure 05.
Figure 05 - Fixed Values for ValueToAnalyze Property |
You probably have guessed what's going on here: the first value in each row (Total Sales, Total Units Sold, Average Unit Price) is the human readable label the user will select in the Drop Down and the second value is an Expression telling how to calculate that concept.
After clicking OK and exiting the Text Area edit mode you will end up with a pretty useless drop down list because even if you can select any of the Display Names you entered on the previous dialog nothing happens on the bottom Bar Chart!
But don't be afraid, connecting the Bar Chart with the Document Property is the second key point of the process and we will fix it right now.
Open the Bar Chart Properties dialog, select the Value Axis option, right click where your current Axis expression is - Sum([store_sales]) in the example - and choose Custom Expression...
Figure 06 - Setting a Custom Expression for the Value Axis |
When the Custom Expression dialog appears clear whatever text is on the Expression field and then search the middle column on the top (Available properties for column:) for the Document Property you have just created.
Select the Document Property and click Insert Properties, now your Custom Expression dialog should look like Figure 07.
Figure 07 - Custom Expression Referencing the Document Property |
If you compare your Analysis with the samples at the beginning of this post you might notice some cosmetic differences like updating the visualization title and axis label when the user selects a new value from the drop down list... that is easily achieved but this post is long enough as it is, so we will leave it for another tip.
Hi Joe,
ReplyDelete10/10 !!! Thank you for making your blogs an embodiment of perfection and simplicity. You make everything so easy to follow.
I am trying to connect to LinkedIn API via BW Container edition and need to pass Access token to get the response. However i do not see any configuration related to OAuth in REST Refrence or Invoke REST API palltete.
Follow my new blog if you interested in just tag along me in any social media platforms!
Obrigado,
Irene Hynes
Hiya,
ReplyDeleteWhat a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this.
Is it possible to mark a number of items in a treemap but having an option to deselect one of the marked items, without affecting the others?
e.g. If I unmark one item everything gets unmarked , I would like the option to only unmark one item at a time.
Appreciate your effort for making such useful blogs and helping the community.
Thank you,
Ajeeth Kapoor
Hi There,
ReplyDeleteWhat a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this.
I need help achieving the task described in the thread title. Let me provide some background:
I am developing a very large dashboard on spotfire that loads a lot of data for visualization. Some of those tables need to be loaded sequentially because of dependencies between them, but others can just be load simultaneously.
For the sequentially loaded tables, I use the following script:
import clr
from System.Collections.Generic import List, Dictionary
from Spotfire.Dxp.Data import DataTable
from Spotfire.Dxp.Framework.ApplicationModel import NotificationService
# Empty list to hold DataTables
Tbls = List[DataTable]()
Tbls.Add(dt1) #dt1 a DataTable string parameter
Tbls.Add(dt2) #dt2 a DataTable string parameter
# Notification service
notify = Application.GetService[NotificationService]();
# Execute something after tables are loaded
def afterLoad(exception, Document=Document, notify=notify):
if not exception:
Document.Properties["lastReload"]
print "OK"
else:
notify.AddErrorNotification("Error refreshing table(s)","Error details",str(exception))
# Refresh table(s)
Document.Data.Tables.RefreshAsync(Tbls, afterLoad)
Excellent tutorials - very easy to understand with all the details. I hope you will continue to provide more such tutorials.
Merci Beaucoup,
Preethi