الدرس 2 · الوحدة 5: Making Dashboards Interactive
Selection actions: charts and lists that filter other elements
الفيديو قريبًا
Learn it with your tutor on the live board
أهم نقاط الفيديو
One Click, Whole Picture
- The morning after a storm: 400 new service requests
- A manager asks: "Where are the downed trees, and how many are still open?"
- Scrolling a list will not answer that fast enough
- One click on a chart bar can filter everything else
What You Will Learn
- What a selection action is: source and targets
- Configure a chart to filter a list, indicator and map
- Handle multiple selections and different layers
Selection Actions in ArcGIS Dashboards
- Source: the element the user clicks (chart, list, table, map)
- Target: the elements that react
- Set on the source's Actions tab
- Reactions: filter, zoom, pan, flash, show pop-up
How a Selection Flows
- User clicks a category on the source
- The selection becomes a filter condition
- Each target applies the filter and redraws
Worked Example: Requests by Type
- Serial chart grouped by request type
- Source for the whole dashboard
- Targets: requests list, count indicator, map
layout: side
kind: bar
title: Service requests by type
data: {Potholes: 42, Graffiti: 27, Streetlights: 18, Water leaks: 13}
steps:
- at: "four request types"
show: all
- at: "clicks the Potholes bar"
highlight: Potholes
note: "List, indicator, map now show 42" Configure It Step by Step
- Edit the chart, open the Actions tab
- Add action: Filter
- Tick targets: list, indicator, map
- On the map target, optionally add Zoom
- Save, then test in view mode
Single, Multiple and Clearing
- Selection mode on the source: single or multiple
- Multiple: each click adds a category
- By default, nothing selected means no filter
- Target option: Render only when filtered
- Click the selected item again to clear it
Different Layers: Field Mapping
- Same layer: the filter just works
- Different layers: map a shared field
- Chart: DISTRICT on water main breaks layer
- Target: DIST_NAME on crews layer
- Values must match exactly: spelling and spaces
The Same Logic in Python
import pandas as pd
req = pd.DataFrame({
"type": ["Pothole", "Graffiti", "Pothole",
"Streetlight", "Water leak",
"Pothole", "Graffiti"],
"district": ["North", "South", "South",
"North", "East", "East", "North"],
})
selected = ["Pothole"] # the clicked bar
view = req[req["type"].isin(selected)]
print("Indicator count:", len(view))
print(view.groupby("district").size()) Common Mistake: The Silent Empty Target
- Breaks layer: "North"; crews layer: "North " or "N1"
- Filter runs, finds no match, shows nothing
- No error message appears
- Fix: check distinct values in both fields first
Exercise: Storm Response Board
- Use a storm or outage layer from Living Atlas or your org
- Add a pie chart by status and a list of incidents
- Make the chart filter the list, an indicator and the map
- Enable multiple selection; test select, add, clear
Recap
- Source is clicked; targets filter, zoom or flash
- Set it on the source's Actions tab, then test in view mode
- Across layers, map fields whose values match exactly
النص المكتوب
One Click, Whole Picture. Picture the morning after a big storm. Your city's service request dashboard shows four hundred new requests, and the operations manager leans over and asks, "Where are the downed trees, and how many are still open?" You could scroll a list, or build a new filter by hand. But what if the manager could just click the Downed trees bar on the chart, and the list, the map and the open count all changed to match? That's what selection actions do. They turn a chart or a list into a control panel for the rest of the dashboard. In this lesson you'll set one up and learn the few settings that make it behave the way people expect.
What You Will Learn. Here's the plan for the next few minutes. First, you'll learn what a selection action is, and two words we'll use all lesson: source and target. Second, you'll configure a real example, a service requests chart that filters a list, an indicator and a map. Third, you'll handle the details that trip people up: letting users pick more than one category, clearing a selection, and connecting elements that read from different layers. By the end you'll be able to wire up any chart or list so it drives the rest of your dashboard.
Selection Actions in ArcGIS Dashboards. In ArcGIS Dashboards, an action is a rule that says, "when something happens here, do something over there." A selection action fires when a user selects items in an element. The element being clicked is the source. It can be a serial chart, a pie chart, a list, a table or a map. The elements that react are the targets. You set this up on the source, in its Actions tab. For most targets, the reaction is a filter, meaning they only show the features that match what was selected. Map targets can also zoom, pan, flash the features, or show a pop-up. Think of the source as a light switch and the targets as the lamps wired to it.
How a Selection Flows. Let's follow one click through the dashboard. A user clicks the Downed trees bar on the chart. The dashboard turns that selection into a filter condition, in plain words, "request type equals Downed trees." That condition is sent to every target you connected. The list drops every other request type. The indicator recalculates its count from only the matching features. The map hides everything else, or zooms to the matching points if you chose that. Notice that nothing is changed in the data itself. The layer in ArcGIS Online is untouched. Only what each element displays changes, and it all resets as soon as the selection is cleared.
Worked Example: Requests by Type. Here's our worked example. To keep the numbers small, we'll leave the storm and use a public works layer, but the steps are exactly the same. A public works team has a hosted layer of one hundred service requests, and a serial chart that groups them by request type, so the bars show four request types with their counts. Next to the chart sit three other elements: a list of requests, an indicator showing the total count, and a map. Right now, all three show all one hundred requests. When a supervisor clicks the Potholes bar, the chart highlights it, and the three targets filter down. The list shows only potholes, the indicator reads forty two, and the map shows just those forty two points. One click, three elements in agreement.
Configure It Step by Step. Let's build it, it takes about a minute. Open the dashboard in edit mode and choose Configure on the chart. Go to the Actions tab, and under When selection changes, add a Filter action. A list of the other elements appears; tick the requests list, the count indicator and the map. For the map, you can also add a Zoom action, so the map jumps to the selected features instead of staying at the city view. Click Done, save the dashboard, and switch to view mode. Test it the way your users will: click a bar, check each target, then click the bar again to clear it and confirm everything returns.
Single, Multiple and Clearing. The source element has a selection mode. Single lets users pick one category at a time, which suits a quick "show me just this" question. Multiple lets each click add a category, say Potholes and then Graffiti, so the targets show both types, sixty nine requests in our example. Here's the rule to remember: by default, an empty selection means no filter at all, so the targets show everything. That's usually what you want. If a target should stay empty until something is selected, turn on Render only when filtered in that target's settings. To clear a selection, click the selected item again, or use the clear selection button on the element.
Different Layers: Field Mapping. So far every element read from the same requests layer, so the dashboard knew how to filter. Often you'll mix layers. Say your chart counts water main breaks by district, and your target is a list of repair crews from a separate crews layer. The dashboard can't guess how those relate, so when you tick that target it asks you to map fields: the source field, DISTRICT on the breaks layer, and the target field, DIST_NAME on the crews layer. The values in those two fields must match exactly, including spelling and spaces. North and North with a trailing space are different values, and so are North and a code like N1. The filter will quietly return nothing. Whether capital letters matter depends on the data source, so don't rely on it either way.
The Same Logic in Python. If you think in code, here's the same idea in a few lines of pandas, a Python library for working with tables. We build seven small requests, each with a type and a district. The selected list plays the role of the clicked bar. The isin filter keeps only rows whose type is in that list, just like the filter action does. The indicator is simply the number of rows left, which is three. Grouping by district shows what a second chart target would draw: one pothole in each of East, North and South. Put two names in the selected list and you've simulated multiple selection, no extra code needed.
Common Mistake: The Silent Empty Target. The most common mistake is a target that goes blank the moment someone clicks. There's no error message, so people assume the dashboard is broken. The usual cause is mismatched values between mapped fields. Take our breaks and crews layers. The breaks layer stores North, while the crews layer stores North with a trailing space, or a code like N1 instead of the name, and the filter finds nothing in common. A spelling variant does the same, such as Main Break against Main Brk. The fix is to open both layers' data tables in ArcGIS Online, compare the distinct values, and clean one of them, or map a field that truly matches.
Exercise: Storm Response Board. Now it's your turn. Before the next lesson, build a small storm response board. Use a storm damage or power outage layer, either from Living Atlas or from your own organization. Add a pie chart grouped by status, such as open, assigned and closed, plus a list of incidents, an indicator with the count, and a map. Configure the pie chart so a selection filters the list, the indicator and the map, and add a zoom action on the map. Switch on multiple selection. Then test three things in view mode: select one slice, add a second slice, and clear the selection. Note anything that surprised you.
Recap. Let's wrap up with three takeaways. First, a selection action has a source, the chart, list, table or map the user clicks, and targets that react by filtering, zooming, panning, flashing or showing a pop-up. Second, you configure it on the source's Actions tab, choose single or multiple selection, and always test in view mode, including clearing the selection. Third, when the source and target read different layers, you map a shared field, and the values in both fields must match exactly, or the target goes silently empty. With these, a chart stops being just a picture and becomes a way to ask questions.
استكشف الرسم المتحرك
الرسوم المتحركة نفسها التي في الفيديو، دقيقة وتفاعلية: شغّلها أو أوقفها، أو اسحب المؤشر، أو انتقل إلى أي خطوة بالسرعة التي تناسبك.
Loading the animation...
ملخص الدرس
- مشاهدة الفيديو
- Source is clicked; targets filter, zoom or flash
- Set it on the source's Actions tab, then test in view mode
- Across layers, map fields whose values match exactly