Jump to content
  • IronPython script For Each Visual


    This script is for use with the TIBCO Spotfire® Application Profiler. It populates additional output columns that will be created when the Application Profiler is run - it should be used in the "Script to Run for Each Visual" script. The companion script for this (that populates the columns) is IronPython Script for Each Visual Output Columns

    Introduction

    This script is for use with the TIBCO Spotfire® Application Profiler. It populates additional output columns that will be created when the Application Profiler is run - it should be used in the "Script to Run for Each Visual" script. The companion script for this (that populates the columns) is IronPython Script for Each Visual Output Columns

    For Each Visual

    The below script must be used along with the Application Profiler found under 'Tools> Diagnostics' to understand the metadata of a dxp file. Users will need to specify the dxp file and the two scripts below - one to run for each Visual and the other specifying the output columns. This will produce several related data tables in a new page that contain the required information.

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    import Spotfire.Dxp.Application.Visuals.BarChartOrientation as barChartOrientation
    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Application.Visuals import VisualTypeIdentifiers
    from Spotfire.Dxp.Application import Page
    from System.Drawing import Rectangle
    
    
    try:
    	p = Visual.GetService(Page)
    	Document.ActivePageReference = p
    	size = p.GetVisualizationAreaSize()
    	rect = Rectangle(0,0, 1024, 768)
    	OutputColumns["Page.Width"] = 1024
    	OutputColumns["Page.Height"] = 768
    	visualBounds = p.GetVisualBounds(Visual, rect)
    	OutputColumns["Visual.Width"] = visualBounds.Width
    	OutputColumns["Visual.Height"] = visualBounds.Height
    except:
    	pass	
    
    Visual = Visual.As[VisualContent]()
    	
    try:
    	OutputColumns["XAxis.Expression"] = Visual.XAxis.Expression
    except:
    	pass
    	
    try:
    	OutputColumns["YAxis.Expression"] = Visual.YAxis.Expression
    except:
    	pass
    
    try:	
    	OutputColumns["ColorAxis.Expression"] = Visual.ColorAxis.Expression
    except:
    	pass
    	
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	trellising = ""
    	if Visual.Trellis.IsTrellising:
    		if Visual.Trellis.ColumnAxis.Expression != "<>" : trellising += Visual.Trellis.ColumnAxis.Expression
    		if Visual.Trellis.RowAxis.Expression != "<>" : 
    			if trellising != "" : trellising += ","
    			trellising += Visual.Trellis.RowAxis.Expression
    		if Visual.Trellis.PageAxis.Expression != "<>" :
    			if trellising != "" : trellising += ","
    			trellising += Visual.Trellis.PageAxis.Expression
    		if Visual.Trellis.PanelAxis.Expression != "<>" : 
    			if trellising != "" : trellising += ","
    			trellising += Visual.Trellis.PanelAxis.Expression
    		
    		OutputColumns["Trellis.ColumnAxis.Expression"] = Visual.Trellis.ColumnAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["Marking"] = Visual.Data.MarkingReference.Name
    except:
    	pass
    try:	
    	filterings = ""
    	for filtering in Visual.Data.Filterings:
    		if filterings != "" : filterings += ","
    		filterings += filtering.Name
    	OutputColumns["Filterings"] = filterings
    except:
    	pass
    
    	
    try:	
    	
    	OutputColumns["WhereClause.Expression"] = Visual.Data.WhereClauseExpression
    except:
    	pass
    	
    try:	
    	legendItems = ""
    	for legendItem in Visual.Legend.Items:
    		if legendItem.Visible:
    			if legendItems != "" : legendItems += ","
    			legendItems += str(legendItem.Title)
    	OutputColumns["LegendItems"] = legendItems
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
    try:	
    	OutputColumns["GroupByAxis.Expression"] = Visual.GroupByAxis.Expression
    except:
    	pass
     

    License: TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...