Select to view content in your preferred language

Cumulative chart very slow to load

85
0
Wednesday
Labels (1)
JamieHawk
Emerging Contributor

Hello all,

I am looking for suggestions on improving an Arcade expression (see below) to perform better in an ArcGIS Dashboard serial chart. (huge thanks to @jcarlson for examples in other threads about cumulative charts!)

The hosted service comprises less than 700 features, but it takes nearly 2 minutes to generate the chart. Yikes! Chrome developer tools reports 1,000+ fetch requests. The dashboard itself is public, you can see the poor performance yourself. Is the finish time appropriate for this quantity of data?

// Get your input layer
var fs = FeatureSetByPortalItem(Portal('https://mrosd.maps.arcgis.com'),'a0e337ab61604575abd25d6e73de92f2', 0, ['ESCROWDATE', 'ASSESSACRE'], false)

// Filtering input to the valid (non-null) years only since a certain date
//Limited date range temporary; for testing only and to ignore NULL dates
var escrow_valid = Filter(fs, "ESCROWDATE  > timestamp '1972-01-01'")

// Grouping by escrow date to get per-date total
var escrows = GroupBy(escrow_valid, 'ESCROWDATE', {name: 'total', expression: 'ASSESSACRE', statistic: 'SUM'})

var fs_dict = {
    fields: [
        {name:'date', type:'esriFieldTypeDate'},
        {name:'running_sum', type:'esriFieldTypeDouble'}],
    geometryType: '',
    features: []
}

var i = 0

for(var e in escrows){
    // Get all dates before or equal to date
    var filt_date = e['ESCROWDATE']
    var running_sum_fs = Filter(escrows, "ESCROWDATE <= @filt_date")
    
    // Populate dict
    fs_dict.features[i] = {
        attributes: {
            'date': filt_date,
            'running_sum': Sum(running_sum_fs, 'total')
        }
    }
    
    console(filt_date)
    console(sum(running_sum_fs, 'ASSESSACRE'))
    
    i ++
}

return featureset(text(fs_dict))

 

Thanks!

Jamie Hawk

Midpen GIS

0 Kudos
0 Replies