- Are you aware that you can write expressions on the Y-Axis but have no idea how?
- Is the syntax for writing expressions on the Y-Axis confusing?
- Would you like to expand your Spotfire calculation skills?
In my opinion, Axis Names are a difficult subject to grasp, and there aren’t many resources out there. TIBCO Help has good information, but broader context to understand concepts is missing. There is very little general information in Google searches. Search results take you to the TIBCO Community and TIBCO Documentation, but again, that broader context is missing. It’s an uphill battle. I aim to fix that.
Last year, I posted an Intro to Axis Names template on Exchange.at that you can download using this link. Now, this template is a great introduction, but there’s so much more to learn. Thus, I have built two more templates explaining Axis Names. Specifically, they each address Axis Names for Reference Lines and Axis Names for Visualization Properties. The combined content plus this blog post provides all you need to know. Let’s get started.
What are Axis Names and why do we need them?
To answer that question, let’s first talk about calculations in general. In Spotfire, there are two ways to write expressions.
- Insert menu > Calculated Columns
- Custom Expression written on the axis or variable selector of a visualization
Each method uses a different syntax. Most users are familiar with the syntax for method one, and Axis Names are used with the second method. So, why not just learn the syntax of one method and then stick with that method?
Well, with the first method, calculated columns are inserted into the data table, and the result will ALWAYS use the entire data set. When writing an expression on the value axis of a visualization, the expression considers filtering. Thus, calculations can be performed on subsets of data. As you can see, it’s very important to understand both calculation methods.
Now, of course, the second method uses a different syntax. It uses Axis Names. Here’s a comparison of the two different syntaxes. For this example, let’s assume we have months on the X-axis. Thus, the expression reads — Take the sum of gas for the individual nodes on the X-Axis (for each month) and divide them each by the sum of gas for all nodes (or months) on the X-axis.
Show Me an Axis Name
Okay, so you’re starting to get the idea. Next, let’s talk scope. As you can see from the table below, there are a lot of Axis Names. Axis Names apply to specific visualizations. If this is a bit overwhelming, skip down and come back after you have gone through an example or two in the template.
|3D Scatter Plot||Axis.Color||Axis.Columns||Axis.Marker||Axis.Pages||Axis.Panels||Axis.Rows||Axis.Size||Axis.X||Axis.Y||Axis.Z|
|Parallel Coordinat Plot||Axis.Line|
Let’s Talk Syntax
Now, let’s talk a little bit more about the syntax and the rules around Axis Names.
- When writing an expression on the Y-Axis (or Value Axis) of a visualization…
- Over and Node Navigation must go with Axis Names, and the expression requires an aggregation. If you are unfamiliar with Over and Node Navigation, take a look at this blog post on node navigation and this post on over. You need to have a solid understanding of Over and Node Navigation before diving into Axis Names.
- Wrap the Axis Name in square brackets, just like column names.
- The syntax uses the word Axis followed by “.”, followed by the specific name (Color, Line, etc).
- Axis Name values are case sensitive. Axis.X is recognizable, but Axis.x is not.
- Which Axis Name is used depends on the type of visualization and what you are trying to accomplish.
- When using Axis Names, the X-axis needs to categorical. In oil and gas, it’s common to put Production Months on the X-Axis, which is continuous. Thus, you must either create a one level hierarchy or change the X-axis to categorical. They axis must be categorical because the expression is “thinking” in terms of “nodes”. Nodes are categorical.
- When writing expressions for properties…
- You must add either Axis.Name.Expression or Axis.Name.DisplayName to the end of the Axis Name. This is specifically addressed in the Axis Names for Visualization Properties template downloadable at this link.
And with that, you know almost everything you need to know about Axis Names. This was a lot of information to digest, and you have three templates to review. Don’t worry if this seems difficult. It’s not an easy concept to grasp, and it takes working with it for a while to really get the hang of it. Please feel free to reach out with any questions. Thanks!
Guest Spotfire blogger residing in Whitefish, MT. Working for SM Energy’s Advanced Analytics and Emerging Technology team!