Jump to content
We've recently updated our Privacy Statement, available here. ×
  • IronPython script to Configure JSViz GroupBy Columns


    TIBCO Spotfire® allows users to create Javascript vizualizations using the JSviz extension.

    Introduction

    TIBCO Spotfire® allows users to create Javascript visualizations using the JSViz extension.

    Configure JS GroupByColumns

    The below script can be used to configure a JSViz visualization. JSViz visualizations in a page and their underlying data tables are first identified. Certain columns in the dataset are then used to group the data in the visualization. The Group By columns determine how Spotfire aggregates the data in the visualization.

     

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    import clr 
    clr.AddReference ("SpotfirePS.Framework.JSVisualization, Version=1.0.0.0, Culture=neutral,PublicKeyToken=4d233badaf236513" ) 
    #
    # Import the JS Visualization model class 
    from SpotfirePS.Framework.JSVisualization.Core import JSVisualizationModel 
    # 
    # Import the JS Visualization Type Identifier class 
    # 
    
    from SpotfirePS.Framework.JSVisualization import JSVisualizationIdentifiers
    
    for viz in Document.ActivePageReference.Visuals:
    	if viz.TypeId == JSVisualizationIdentifiers.JSVisualization:
    		break
    #
    # Cast the visualization object to the correct type 
    #
    jsviz = viz.As[JSVisualizationModel]()
    
    #print jsviz.View.DataView.Columns[4]
    #print jsviz.View.ColumnExpressions
    
    dt = jsviz.View.BaseTableReference
    jsviz.View.GroupByColumns = [dt.Columns["Nation"], dt.Columns["Region"]]
    print jsviz.View.GroupByColumns
     

    License: TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...