Select to view content in your preferred language

Multiple drop down menus to filter plots/tables

1730
12
Jump to solution
04-19-2022 07:44 AM
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Good day all,

I am trying to create a web app in Insights Desktop such that the app has two drop down menus:

  1. One for variable of interest 
  2. Second for location

As you can see I can select the location column in the 2nd drop down since it's a single column. However, I am unable to select multiple columns (each column representing a different variable, 5 columns/5 variables in my case).

If it it was possible to select multiple columns from a drop down menu, then for example, the user would first select the variable of interest let's say `avm`  that would then show `avm` values for different cities depending on the selection from the 2nd drop down menu. Then if the user selected the variable `flood factor` it would filter location values to `flood factor`.

Is it possible to select multiple columns for a drop down menu in Insights desktop? Such an option will save me from creating separate plots for each variable.

If not can you please have option in the next release?

As such an option will really make the app concise, neat and clean.

Please note that both the drop menus are based on the same dataset.

SaadullahBaloch_0-1650379421459.png

 

Question | Analyze | Visualize
0 Kudos
12 Replies
Ed_
by MVP Regular Contributor
MVP Regular Contributor

@Scott_Aulen, thank you for the detailed response. So, I need to transform the dataframe to either of the following two right, so which one of these would be the right approach 1or 2?

  1. SaadullahBaloch_0-1650481585957.png

     

  2. SaadullahBaloch_1-1650481718681.png

     

Cheers,

Question | Analyze | Visualize
0 Kudos
Scott_Aulen
Esri Contributor

That's correct, you'd want Option 2.  You want to move all three variables (FF, AL-2021, AL-2051) to one column (which you have labeled variable).

Ed_
by MVP Regular Contributor
MVP Regular Contributor

@Scott_Aulen worked like a charm, I had to slightly modify the data as suggested in R. For that I had to use the `pivot_longer` function via `dplyr`. Thanks again.

Relevant code in R: 

 

 

 

library(tidyverse)

df = df %>% select(long,
lat,
FF,
AL_2021,
AL_2051,
District,
City,
Zipcode) %>%
pivot_longer(c(FF,
AL_2021,
AL_2051),
names_to = "Variable",
values_to = "Value")

 

 

Question | Analyze | Visualize
0 Kudos