Jump to content
We've recently updated our Privacy Statement, available here. ×
  • How to Set Formatting for Individual Scales of an Axis in a LineChart in Spotfire® Using IronPython Scripting


    This article provides a sample script on how to set formatting for individual scales of an axis in a LineChart

    Introduction

    This article provides a sample script on how to set formatting for individual scales of an axis in a LineChart

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Data import *
    from Spotfire.Dxp.Data.Formatters import *
    
    
    lc=vis.As[LineChart]()
    lc.YAxis.Expression="Sum([X]),Sum([Y])"
    
    #Enable Multiple Scales
    lc.YAxis.IndividualScaling=True
    
    #Dock scales as needed
    lc.YAxis.Scale.IndexedDock["Sum(X)"] = ScaleDock.Far;
    lc.YAxis.Scale.IndexedDock["Sum(Y)"] = ScaleDock.Near;
    
    #Get the current Formatting
    currentFormatting=lc.YAxis.Scale.Formatting
    currentFormatting.Clear()
    
    #create number formatter
    numberFormatter = DataType.Real.CreateLocalizedFormatter()
    numberFormatter.Category = NumberFormatCategory.Number
    numberFormatter.DecimalDigits = 3
    #create percentage formatter
    percentageFormatter = DataType.Real.CreateLocalizedFormatter()
    percentageFormatter.Category = NumberFormatCategory.Percentage
    percentageFormatter.DecimalDigits = 0
    
    # set formatting for individual scales
    lc.YAxis.Scale.Formatting.IndexedRealFormatter["Sum(X)"]=numberFormatter
    lc.YAxis.Scale.Formatting.IndexedRealFormatter["Sum(Y)"]=percentageFormatter
     

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