- Have you ever wanted to include multiple labels, but run into limitations where Spotfire only allows you to add one?
This problem can be solved with a simple hack using a custom expression. As you can see in the screenshot below, there isn’t an option to add more than one column of data to a label. A simple fix for this is to right click and use Custom Expression.
Use the concatenate function to string together columns of data, and separate them with additional arguments. In the example shown below, I am concatenating Operator, FieldName and Lease and separating them with dashes and spaces.
The end result looks like this.
Updated 8/24/2017:
This hack works for scatter plots, 3D scatter plots and map charts. It will work anytime you see the label by selector (shown in red below), which is where you right click and select ‘Custom Expression’.
You won’t see this in line charts, bar charts, and many other visualizations.
Guest Spotfire blogger residing in Whitefish, MT. Working for SM Energy’s Advanced Analytics and Emerging Technology team!
Another tip – if you just use & instead of concatenate, you can also insert a “\n” in between columns to make them space down a level. For example, writing [TWN] & [TWN_DIRECTION] & “\n” & [RNG] & [RNG_DIRECTION] will give a clean looking label on tonwship/range shapefile data!
Thank you for that suggestion!
Is this possible for line graphs, too? I am having trouble finding the “Custom expression” option in the Properties menu.
Thank you!
Not for line graphs.
One should know that you can use this feature only in scatter plot
You can use this feature in scatter plots, 3D scatter plots and map charts. I’ll update the post. Basically, if there is a drop down selector that you can right click on and select custom expression, you can use this feature.
Can scripting be used to add labels? Especially for bar charts and line charts.
You can show and hide labels with IronPython.
Is there a way to show the labels as a percent of total row count in a scatterplot using tiled markers? I have a simple 3×3 scatterplot and i can show the count in each tile, but I want to show it as a % of total instead. I can see how to do it using a % of eithe tthe x or y axis, but I want to show it as a % of total.
I would add a calculated column to get your row count. Use the rowid function and then take the max of the row id. max(rowid())
Please note, I am now writing at https://bigmountainanalytics.com/blog
Is there a way to implement the custom naming through an ironpython script? Thank you
Is this concatenate specific to version. Because i am working on 7.11 and after concatenate it gives me error and it doesn’t work. The expression block is red.
Concatenate is not specific to a version. It is specific to a data type. Are you sure that your column is a string?
Is it actually possible to have the label vertical but read Top to Bottom instead of the label characters going to Bottom to Top on the axis?
Users have very little control over labels, unfortunately.