Add units next to scale label numbers on a Spotfire chart axis

[ninja-popup ID=1094] Click here to download and follow along with the Spotfire file shown in this article [/ninja-popup]

I’ve been asked many times “How do I add units to columns in Spotfire?” It some cases it would be nice to have units next to a chart axis value, as shown in the picture below. Well, the truth is, there’s not a feature in Spotfire that allows you to specifically do this, but there are a couple of workarounds.

1_Example with Units

How to Show Axis Units in Spotfire – Option 1

The simplest option is just to include the units in your column name, as shown below.

Ex 1: Oil – BOPD
Ex 2: Oil (BOPD)

1.5_Spotfire_Axis_selector

This makes it really obvious to anyone looking at your Spotfire project what the units are. The drawback of doing it this way is that while you can see the units on the axis selector, they don’t appear next to the axis values (scale labels).

You can rename the column in the source data table before loading into Spotfire, but the easiest option is just to rename the columns in Spotfire. To do that, follow the steps below.

  1. Click Edit > Column Properties

2_Edit_Column_Properties_Spotfire

  1. Select the data table that your column is in from the drop down at the top of the Column Properties box.
    1. For example, if you want to add units to your Oil column, and that column is in the Prod Table, select Prod Table from the dropdown. If you only have one table in your Spotfire project, this area is blank.

3_Column_Properties_Spotfire

4_Column_Properties_with_1_Data_Table_Spotfire

  1. Navigate to the column by searching or scrolling through the list of columns. Click on the column you want to modify.

5_Select_column_in_column_properties_Spotfire

  1. Change the column name by editing the Name field.
  2. Click OK to apply the changes and close the window.

6_Edit_name_in_Spotfire

  1. Now the Axis Selector with the Oil column shows the units of ‘BBL’ with the column name. By editing the name at the Column Properties level, instead of the Visualization level, the units will show up every time that column is used in the future.

7_Axis_selector_with_unites_Spotfire

 

A Note about Column Names

You can always edit column names in Spotfire without worrying about losing linkage to your source data. Spotfire remembers the original column name, so the next time you refresh the data, it will still know which column to pull data from. To verify this:

  1. Open up the Column Properties and select the Oil column.
  2. Click the ‘Properties’ tab.
  3. Look at the the ‘External Name’. This is the column name as it exists in your source data.

8_External_column_name_Spotfire

How to Show Units in Spotfire – Option 2

The second option demonstrates how to show units directly next to the numbers, such as 100 BBL, as pictured at the top of this page. This is accomplished using Short Number Formats.

If you’re new to short number formats, or have never even heard of that feature before, check out this article (How to Create Custom Short Number Formats in Spotfire) to learn more. Short number formats are used on a chart axis to replace zeros with a symbol.

Ex: 1,000 = 1k

In above example, 10^3 is replaced with the symbol ‘k’. However, you can also use the power of 0. Anything raised to the power of zero is the original number.

Ex: 1,000^0 = 1,000

By telling Spotfire to replace 10^0 with your desired symbol (i.e. the units, ‘BBL’), essentially all you’re doing is adding units to the end of the number.

Steps to add Units via Short Number Formatting

  1. Open the Edit Symbol Sets options. Not sure how to get there? Click here and follow steps 1-3.
  2. Add a new symbol set

10_Add_new_sybol_set

  1. Type ‘Oil’, since we’re going to use this symbol set for any axis with our Oil column. Click OK.

11_Add_new_symbol_set_Spotfire_2

  1. Click ‘Add…’ to add a new symbol set. Leave the Exponent as 0, and type the units, BBL, into the Symbol box. Click OK.

12_Add_new_symbol_set_Spotfire_3

13_New_Symbol_Spotfire

  1. Repeat the steps above to add a new symbol set, this time for Gas, using ‘MCF’ for the units.
  2. Your screen should now look like the picture below.

13.5_Custom_Symbol_sets_spotfire

  1. Click OK twice to get back to your active page.

Modify Axis Formatting

Now all you need to do is modify the Axis Formatting to apply the short number formats that you just created.

  1. Open the Formatting options in the visualization properties of the Oil chart
  2. Check the box next to ‘Use short number format’
  3. Select the ‘Oil’ symbol set that you just created

14_Choose_short_number_format

  1. Repeat Steps 1-3 for the Gas chart

 

Prefer to have Oil and Gas lines on the same chart?

No problem, we can easily accomplish this with multiple scales on the Y axis.

  1. Add Oil and Gas to the Y Axis selectors as separate columns

15_Spotfire_add_new_Series

  1. Open the visualization properties

16_Visualization_properties_icon_Spotfire

  1. Select ‘Y-axis’.
  2. Select ‘Multiple scales’. Select ‘For each color’

17_Mutiple_Scales_on_Y_axis_Spotfire

  1. Follow the steps above in Modify Axis Formatting to apply the short number formats to both Y Axis columns

18_Oil_short_number_format_Spotfire

19_Gas_short_number_format_Spotfire

  1. Close the Properties, and your chart should look like this:

20_Different_units_on_each_Spotfire_chart_axis

Questions / Comments
If you have any questions or comments, or if there’s something you’d like featured on this blog, feel free to email me at kyle@datafuel.co or leave a comment below.

[ninja-popup ID=1094] Click here to download the Spotfire file used in this article [/ninja-popup]

1 thought on “Add units next to scale label numbers on a Spotfire chart axis

  1. Pat Reply

    Hello, can you suggest how to plot 2 units in the same axis (m and ft.)? Moreover when we prefer to select in meter or ft unit the graph change the plot as selected.

Leave a Reply

Your email address will not be published. Required fields are marked *