Select to view content in your preferred language

Widget Not Responding to Map Actions with Data Expressions

528
3
09-26-2024 10:14 AM
JonJones1
Frequent Contributor

Hello Community,

I'm currently developing an ArcGIS Dashboard and encountering an issue with pie charts created using Arcade data expressions. Despite following various guidelines and attempting multiple solutions, the pie charts are not interactive with the map. Specifically:

  • No Response to Map Interactions: Zooming and panning the map do not affect the pie charts.
  • Pie Charts Not Listed in Map Actions: The pie charts do not appear as available options in the map's Map Actions settings within the dashboard.

What I've Done So Far

  1. Created Pie Charts Using Arcade Data Expressions:
    • Categorized providers based on specific conditions.

Below is the current version of my Arcade data expression (sensitive information has been masked):

// Data expression for Service Provider Pie Chart
var fs = FeatureSetByPortalItem(
    Portal('https://example-portal.com'),
    'your-portal-item-id', // Replace with your actual Portal Item ID
    0, // Layer ID
    ['Provider', 'Tons', 'State', 'ObjectId'], // Fields to include
    false // Do not include geometry
);

// Group by categorized Provider and sum Tons
var providerTons = GroupBy(
    fs,
    [
        {
            name: 'Category',
            expression: `
                CASE 
                    WHEN Provider IN ('Provider1', 'Provider2', 'Provider3', 'Provider4') 
                        THEN Provider
                    WHEN (
                        Provider IN ('Provider5', 'Provider6', 'Provider7', 'Provider8', 'Provider9') 
                        OR 
                        (Provider = 'Provider10' AND State = 'StateX')
                    )
                        THEN 'Group1'
                    ELSE 'Others'
                END
            `
        }
    ],
    [
        {
            name: 'TotalTons',
            expression: 'Tons',
            statistic: 'SUM'
        }
    ]
);

// Sort the results by TotalTons in descending order
var sortedProviderTons = OrderBy(providerTons, 'TotalTons DESC');

// Return the sorted results
return sortedProviderTons;

Questions

  1. Missing Map Actions: Why are the pie charts not appearing as options in the map's Map Actions settings despite being created using data expressions?
  2. Interactivity Issues: What steps can I take to ensure that the pie charts respond to map interactions like zooming and panning?
  3. Role of Unique Identifiers: Is including a unique identifier like ObjectId necessary for enabling interactivity?

Any insights or suggestions would be greatly appreciated. Thank you in advance for your help!

0 Kudos
3 Replies
JenniferAcunto
Esri Regular Contributor

ArcGIS Dashboards needs either a spatial or attribute relationship to set up actions between different data sources. You can view what type of relationship is supported for each element in the Configure actions for elements help section. Map Actions use a spatial relationship between layers, therefore your data expression would need to include geometry.

In a spatial relationship, the following occurs:

  • If an element is configured with Categories from features, feature geometries from the source element are used to intersect geometries of the target element.
  • If an element is configured with Categories from grouped values, an envelope around features in a category from the source element is used to intersect geometries of the target element.

Configure actions for elements: Map Actions

Considerations for Using Actions

- Jen
0 Kudos
JonJones1
Frequent Contributor

 

Hello Jen,

Thank you for your previous response. I've made the changes you suggested, but I'm still encountering issues with making my pie chart interactive with the map. Here's what I've done:

  1. I updated my data expression to include geometry by changing the last parameter in the FeatureSetByPortalItem function from false to true.
  2. I've configured my pie chart to use "Categories from Grouped values" instead of "Features", as shown in the attached screenshot.
  3. I've double-checked that the pie chart is using the correct Category and TotalTons fields from my data expression.

    However, despite these changes, the pie chart still doesn't appear as an option in the Map Actions settings. I'm not seeing any way to make it interactive with the map.

    Here's a masked version of my current data expression:

    // Data expression for Service Provider Pie Chart
    var fs = FeatureSetByPortalItem(
        Portal('https://example-portal.com'),
        'your-portal-item-id', // Replace with actual Portal Item ID
        0, // Layer ID
        ['Provider', 'Tons', 'State'], // Fields to include
        true // Include geometry
    );
    
    // Group by categorized Provider and sum Tons
    var providerTons = GroupBy(
        fs,
        [
            {
                name: 'Category',
                expression: `
                    CASE 
                        WHEN Provider IN ('Provider1', 'Provider2', 'Provider3', 'Provider4') 
                            THEN Provider
                        WHEN (
                            Provider IN ('Provider5', 'Provider6', 'Provider7', 'Provider8', 'Provider9') 
                            OR 
                            (Provider = 'Provider10' AND State = 'StateX')
                        )
                            THEN 'Group1'
                        ELSE 'Others'
                    END
                `
            }
        ],
        [
            {
                name: 'TotalTons',
                expression: 'Tons',
                statistic: 'SUM'
            }
        ]
    );
    
    // Sort the results by TotalTons in descending order
    var sortedProviderTons = OrderBy(providerTons, 'TotalTons DESC');
    
    // Return the sorted results
    return sortedProviderTons;

    Below is a screenshot of my current pie chart configuration:

    Is there something I'm missing? Do you have any other suggestions for making this pie chart interactive with the map?

    Thank you for your continued help with this issue.

    1.jpg

0 Kudos
JonJones1
Frequent Contributor

Hi Jen, and to anyone else who might read this and my post below,

I’ve been thinking about the issue with the pie chart, and I believe the problem comes down to how I grouped the data. When I created the group, it wasn’t part of the original dataset, so it’s like I made a new layer of grouped values, which isn’t interacting with the map’s original feature layer.

I think that’s why I can’t get the pie chart to work, because I essentially created something “new,” and something not found in the map, if that makes sense…

If any future GIS person sees this and knows if I’m right or wrong, or if there’s something I’m missing, please let me know!

God be with you.

0 Kudos