I am trying to make a line chart in the popup from a related table of inspections. The Arcade expression spits out data, but the chart does not work.
Any idea how to get the chart to work?
Thanks
AJ
Code
// Get the related table
var table = FeatureSetByName($map, "Monitoring");
// Feature's matching ID (Name)
var myID = $feature["Name"];
// Array to hold features for chart
var features = [];
// Loop through table rows
for (var row in table) {
// Only include rows matching the current feature
if (row["CulvertID"] != myID) {
continue;
}
var d = row["Date"];
var h = row["AverageHeight"];
// Skip invalid or empty data
if (IsEmpty(d) || IsEmpty(h)) {
continue;
}
// Push attributes as needed for chart
Push(features, {
attributes: {
Date: d,
AverageHeight: h
}
});
}
// Return data for popup chart
return {
fields: [
{ name: "Date", type: "esriFieldTypeDate" },
{ name: "AverageHeight", type: "esriFieldTypeDouble" }
],
geometryType: "",
features: features
};
Results
dictionary
features: array(5)
0: dictionary
attributes: dictionary
AverageHeight: 34.25
Date: Mar 5, 2025, 8:47:34 AM Eastern Standard Time
1: dictionary
attributes: dictionary
AverageHeight: 34.83
Date: Mar 12, 2025, 1:39:34 PM Eastern Daylight Time
2: dictionary
attributes: dictionary
AverageHeight: 34.17
Date: Mar 19, 2025, 2:59:09 PM Eastern Daylight Time
3: dictionary
attributes: dictionary
AverageHeight: 0
Date: Mar 27, 2025, 2:15:07 PM Eastern Daylight Time
4: dictionary
attributes: dictionary
AverageHeight: 0
Date: Jun 18, 2025, 8:52:35 AM Eastern Daylight Time
fields: array(2)
0: dictionary
name: "Date"
type: "esriFieldTypeDate"
1: dictionary
name: "AverageHeight"
type: "esriFieldTypeDouble"
geometryType: ""