Skip to main content
RSS feed Subscribe to feed


Short Number Formatting

This example creates a formatter that uses short number formatting with auto decimals together with currency. A new symbol scheme is created and applied to the short number formatting.

Requires Spotfire 2.2.

 // Create a formatter.
 NumberFormatter formatter = (NumberFormatter)DataType.Real.CreateFormatter();

 // Only the number and currency category can have short formatting.
 // Set the category to currency, and use $ as currency symbol.
 formatter.Category = NumberFormatCategory.Currency;
 formatter.CultureInfo = new System.Globalization.CultureInfo("en-US");

 // Enable short formatting.
 formatter.ShortFormattingEnabled = true;

 // Create a symbol scheme to use in the short formatting.
 List<ShortFormattingSymbol> symbols = new List<ShortFormattingSymbol>(3);      
 symbols.Add(new ShortFormattingSymbol(" ten", 1)); 
 symbols.Add(new ShortFormattingSymbol(" hundred", 2)); 
 symbols.Add(new ShortFormattingSymbol(" thousand", 3));
 ShortFormattingSymbolScheme scheme = 
 		new ShortFormattingSymbolScheme("Simple", symbols);

 // Set the symbol scheme and set decimal digits to auto.
 formatter.ShortFormattingSymbolScheme = scheme;
 formatter.DecimalDigitsMode = DecimalDigitsMode.Auto;