Jump to content

Short Number Format through IronPython Script

Vaibhav Aralkar

Recommended Posts

Hi All,

I'm using below script tp handle the Y axis number formatting based on the DropDown selection.

Along with this, I want the the Y axis numbers to be displayed in the Shorter format like B,M,k etc.


from Spotfire.Dxp.Application.Visuals import BarChart,ScaleLabelLayout, LabelInformationType

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

from Spotfire.Dxp.Data import DataType

barChart = myInputBarChart.As[barChart]()

axisFormatter = DataType.Real.CreateFormatter();

if Document.Properties["KPI"]=="Volume":

axisFormatter.Category = NumberFormatCategory.Number;

barChart.YAxis.Scale.Formatting.RealFormatter = axisFormatter

elif Document.Properties["KPI"]=="Revenue":

axisFormatter.Category = NumberFormatCategory.Currency;

barChart.YAxis.Scale.Formatting.RealFormatter = axisFormatter

Link to comment
Share on other sites

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