Select to view content in your preferred language

Serial Chart Calculation

600
11
Jump to solution
05-22-2025 01:29 PM
GaryMorris
Occasional Contributor

I am creating a Dashboard with several different serial charts.  My data has a length field in feet; I am not able to edit the data or add a field.  I need to have a bar chart that displays the length in miles.  Is there a way for me to calculate this within the serial chart?

0 Kudos
11 Replies
GaryMorris
Occasional Contributor

I finally figured it out, I needed to add the Path_Rating_txt to the push features.  Thank you so much for your all of your patience and help!  I owe you one!

GaryMorris
Occasional Contributor

 

I made one minor change; I changed the bolded part to "length_Miles" and it returns the converted value in miles.  The only issue is it is returning the Path_Rating_txt as all null values.  I tried adding a new variable to include the  Path_Rating but it is returning all null values as well.

 

Try this:

var portal = Portal('https://arcgis.com');

// Provide the actual Portal Item ID and layer index
var fs = FeatureSetByPortalItem(portal, '<PORTAL_ITEM_ID>', 2, ['PATH_Length', 'Path_Rating_txt'], false);
 
// Build an array of new features
var features = [];

for (var f in fs) {
    var lengthFeet = f["(PATH_Length"];
    var lengthMiles = Round(lengthFeet / 52802)


    Push(features, {
        attributes: {
            length_mileslengthMiles,
        }
    });
}

// Define the fields (include the new one for miles)
var convertedValues = {
    fields: [
        { name'Path_Rating_txt'type'esriFieldTypeString'},
        { name'PATH_Length'type'esriFieldTypeDouble' }
    ],
    geometryType'',
    featuresfeatures
};

return FeatureSet(convertedValues);
0 Kudos