With KPI charts in TIBCO Spotfire® it is possible to achieve drill down inside the same KPI chart when the user clicks/taps on a KPI Tile. This is acheived by using Actions that trigger IronPython scripts to set the Tile By axis of the chart, and to also limit the data of the KPI chart through a document property. This requires that the server accepts IronPython scripts.
The attached DXP file works in the following fashion:
The user starts at the Store KPI page. The KPI chart has Tile By axis set to "Store"
The user clicks/taps on a KPI tile, lets assume "City Store 3"
A script called ClickOnTile is triggered that sets the Tile By axis of the chart to "Department" through a Document Property called "TileBy" and also Limits the data through a Document property called "SelectedStore".
The Data limiting expression is set to:
This means that the KPI will be tiled on the Department level instead of Store, and that data will be limited to Departments within the clicked Store.
This is how the ClickOnTile script looks. The second branch of the if/else statement is for the case when user has already clicked on a store and the tileBy axis is already set to "Department".
if Document.Properties["TileBy"] == "Store": Document.Properties["SelectedStore"] = Context.HierarchyPathValues Document.Properties["TileBy"] = "Department" else: Document.Properties["SelectedDepartment"] = Context.HierarchyPathValues Document.ActivePageReference = TargetPage
The script changes the KPI chart to the following view:
If the user clicks the <Back link in the text area, a Script called Reset will set the TileBy document property to Store again, and will Set the SelectedStore Document property to "All":
This is the Reset script:
Document.Properties["TileBy"] = "Store" Document.Properties["SelectedStore"] = "All" Document.ActivePageReference = TargetPage
If the user instead would click on a Tile of a Department, the ClickOnTile script is run again but now will go into the "else" branch, meaning that the user will be navigated to another page with a Table visualization and a Text Area with a <Back button that triggers the Reset script above.
Hope this is useful and looking forward for comments on this topic!