Jump to content
  • How to format the Y axis of any given visualization in Spotfire® Using IronPython Scripting


    This article provides a sample script on how to format Y axis of any given visualisation.

    Code sample

    Script shows how to format Y axis of any given visualisation.

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import DataType
    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Data.Formatters import  *
    
    #Create a formatter for the scale
    nf = DataType.Real.CreateLocalizedFormatter()
    # alternative: nf = DataType.Real.CreateFormatter()
    
    # Example: set the category to percentage and the number of decimal points to 2
    nf.Category = NumberFormatCategory.Percentage
    nf.DecimalDigits = 2
    
    # Example for setting the category to number
    #nf.Category = NumberFormatCategory.Number
    #nf.DecimalDigits = 2
    
    vc=None
    
    for  vis in Application.Document.ActivePageReference.Visuals:
       if  vis.Title == "your visualization title":
        vc = vis.As[VisualContent]()
    
    #set formatting
    vc.YAxis.Scale.Formatting.RealFormatter = nf
     

     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...