Lists in ArcGIS Dashboard are great. They are one of my go-to elements. They are an easy way to display information and control dashboard interactions. The only downside is that they work on a feature-by-feature basis. Sometimes, we just want to display a list of unique values in our data. Unfortunately, the list element has other ideas.
Not only is this list of repeating values not great, but filtering from the list only displays a single feature.
What we really want is something like this.
Our different event types are nicely grouped so the list is unique, we even have a count of the number of events each type has. Filtering from the list displays all features with that event type.
So how did I pull this off? If you guessed that I used a Data Expression or reformatted my data, you would be incorrect.
This unique list is not a list at all. Instead, it is a table element masquerading as a list. Before the table element was introduced, I used to make faux tables out of lists, so there’s a nice bit of symmetry with this solution.
I created a table and used the Grouped values type and selected my event types as the category field. Next, I added a value field that counts the ObjectIDs so I can determine how many features I have in each event type.
Note: If you only want to display the unique list of categories, you don't have to add a value field.
It’s important to note that you only have access to the attributes that you add on the Data tab. This dataset has all sorts of fields, but only the two I specifically added are available to me.
You also don’t want to go overboard with adding fields, as each value field you add creates a column that you can’t get rid of, only disguise. So, you may end up with a lot of empty space in your list.
On the Table tab, I changed the vertical grid color to match the background color.
Moving to the Header tab, I turned off the headers.
The real magic is taking place in the Values tab, where I am using Advanced Formatting and Arcade to make my table look less table like.
I didn’t want my event counts to be in their own column, so I used Arcade to return some HTML that bolds my event type and adds the event count on a new line.
var html = Concatenate('<b>' + $datapoint.EVENT_TYPE + '</b><br>' + Text($datapoint.count_OBJECTID, '###,###'))
Then I returned the HTML as the display text for my Event Type column and changed the ObjectID column display text to empty quotes.
My ObjectID column still exists and takes up space. If I make that column have a red background you can get a better idea of what I’m talking about.
I could set my table to ‘Fit to data’ and then resize my element so that that column barely shows, but I risk having a random horizontal scroll bar show up at the bottom. With so many different screen sizes it’s hard to size it right where you won’t get the scroll bar but also don’t have a lot of empty space.
I decided that if I have to have that column, then i will simply repurpose it.
I added some custom icons and used Arcade to dynamically display the icon and color.
Note, dashboard will override the icon color, so if you don’t specify it in the return statement, they will be the default color, even if the actual icon you added has color.
The final step was to add a nice title on the General tab and voilà my unique list is done.
Check out the rest of my Dashboard tips in my Dashboards That Pop series.
Happy Dashboarding!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.