Steve Fernandez Posted May 10, 2021 Share Posted May 10, 2021 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 currentFormatting=myvis.YAxis.Scale.Formatting currentFormatting.Clear() #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 More sharing options...
Steve Fernandez Posted May 10, 2021 Author Share Posted May 10, 2021 Well, huh. Looks like this is probably a similar situation to this oldie. https://community.spotfire.com/questions/script-change-cross-table-number-format-not-working This gives me some insight into why it might not be working, but no closer to a solution. Link to comment Share on other sites More sharing options...
Steve Fernandez Posted May 10, 2021 Author Share Posted May 10, 2021 DUH! IndexedCurrencyFormatter Link to comment Share on other sites More sharing options...
Shailendra Tripathi Posted August 4, 2021 Share Posted August 4, 2021 Here is solution to your question: Replace below script myvis.YAxis.Scale.Formatting.IndexedRealFormatter[scaleDock.Far] = numberFormatter Link to comment Share on other sites More sharing options...
Prateek Rawat 3 Posted February 10, 2023 Share Posted February 10, 2023 Found any solution to this? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now