- Have you ever wanted to create groupings along the x axis but not been sure how to do that?
- Have you used show/hide in the Properties dialog but wanted more of a combine feature?
If you follow the blog regularly, you’ve seen plenty of postings with information about writing custom expressions, especially along the y axis. You can also write custom expressions on the x axis, and that is precisely what we will do in order to combine data along the x axis.
This first screen shot is our starting point. We have gas production on the y axis and a well name on the x axis. Ideally we only want to see the top 10 wells, and we want everything else to be lumped into one bar so that the chart shows the “best” wells and everything else is lumped together.
In order to get the desired result, we want to write an expression on the x axis of the visualization (not the y axis). Here is the expression shown in the dialog and cut/paste below.
If(DenseRank(Sum([GasProd]) over ([Well Name]),”desc”)<=10,[Well Name],”All Other Wells”) as [Well Name]
This is the end result. We see 10 distinct wells and the rest are combined into one bar.
Guest Spotfire blogger residing in Whitefish, MT. Working for SM Energy’s Advanced Analytics and Emerging Technology team!