Jump to content
  • How to Get/Set Colors for the Breakpoints of a Continuous Color Rule in Spotfire® Using IronPython Scripting


    This article provides a sample IronPython script on how to get/set the colors of the different breakpoints created for a Continuous Color Rule of a visualization.

    Introduction

    This article provides a sample IronPython script on how to get/set the colors of the different breakpoints created for a Continuous Color Rule of a visualization.

    Code Sample

    # Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import *
    import System
    from System.Drawing import Color
    
    vis=ctable.As[CrossTablePlot]()
    
    # Get the coloring you want based on index or iterate over as needed
    coloring=vis.Colorings[0]
    print coloring.DisplayName
    
    # Get the Continuous Color Rule based on index
    rule=coloring[0]
    
    # Get the breakpoints of the Continuous Color Rule
    breakpoints=rule.Breakpoints
    
    #Print the break point value and color. Set Color if needed.
    for breakpoint in breakpoints:
    	print breakpoint.Value
    	print breakpoint.Color.Name
    	print breakpoint.ManualDisplayName
    	# to set a color
    	#breakpoint.Color=Color.FromName("Green")

     

    References

    License: TIBCO BSD-Style License

    Back to IronPython Scripting in TIBCO Spotfire Examples:  https://community.spotfire.com/s/article/IronPython-Scripting-in-Spotfire


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...