Jump to content

Cannot get IndexedRealFormatter to work

Steve Fernandez

Recommended Posts

I'm trying to apply formating to specific series within a Combination Chart. The basic format using works fine, but applies the format to everything. I've spent all day on this, and I'm stumped why it just won't work on a named series. I assume it's related to how I'm trying to address the column, but there aren't a lot of examples online to follow.


from Spotfire.Dxp.Data import *

from Spotfire.Dxp.Application.Visuals import *

from Spotfire.Dxp.Data.Formatters import NumberFormatter, NumberFormatCategory

from Spotfire.Dxp.Data import DataType

from System import Guid


#Get the visualization from current page

guid = Guid("178214cb-4dab-4927-95d2-de99936b56ef")

myvis = Application.Document.ActivePageReference.Visuals.TryGetVisual(guid)[1].As[CombinationChart]()


#the above method works


#Get the current Formatting - clears formatting on the whole combination chart




#create currency formatter

numberFormatter = DataType.Real.CreateLocalizedFormatter()

numberFormatter.Category = NumberFormatCategory.Currency # Set number category to 'Currency'

numberFormatter.ShortFormattingEnabled = True

numberFormatter.DecimalDigits = 0 # Set decimal places to 0


#test for just one column - this does not work

#expression is 'Sum([REVENUE]) As [Revenue]'

myvis.YAxis.Scale.Formatting.IndexedRealFormatter["Revenue"] = numberFormatter


#also doesn't work

#myvis.YAxis.Scale.Formatting.IndexedRealFormatter["Sum(REVENUE)"] = numberFormatter


#this does - but applies to the entire chart

#myvis.YAxis.Scale.Formatting.CurrencyFormatter = numberFormatter

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...