Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Drill down inside a Spotfire® KPI chart

    With KPI charts in 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:

    1. The user starts at the Store KPI page. The KPI chart has Tile By axis set to "Store"

    2. The user clicks/taps on a KPI tile, lets assume "City Store 3"

    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:

      "If("${SelectedStore}"= "All",TRUE,"${SelectedStore}"=[store])"

      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"

      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
    4. 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.

    5. Hope this is useful and looking forward for comments on this topic!

      if Document.Properties["TileBy"] == "Store":
         Document.Properties["SelectedStore"] = Context.HierarchyPathValues[0]
         Document.Properties["TileBy"] = "Department"
         Document.Properties["SelectedDepartment"] = Context.HierarchyPathValues[0]
         Document.ActivePageReference = TargetPage


    Download attached zip file from resources


    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...