Hi ESRI community,
Currently, the below arcade script to render a linechart in a pop-up, that uses data from another not related or joined hosted feature service table, is showing this execution error:
Does anyone have any advice or clue how to approach this error and correctly render a linechart in a popup using this type of arcade method?
//set variable to sensor_id
var nodes = $feature.sensor_id
//set variable to portal item to return from a feature table a feature set
var ArchiveData = FeatureSetByPortalItem(
p, "0749f4597e054caf809b5b55d0b869d4",
0,
['sensor_id','time_stamp','pm25calibrated','avg_'],
false
)
// filter through table, matching the table's sensor_id with sensor_id per feature in this layer (line2)
var AD = OrderBy(Filter(ArchiveData, 'sensor_id = @nodes'), 'time_stamp')
//relationship between
var chartValues = {}
var chartNames = []
// get time stmpt from current $feature
//Text($feature.EditDate_1693522081818, 'H:mm dddd MMMM D, Y')
for (var f in AD) {
chartValues[Time(f.time_stamp, 'H:mm dddd MMMM D, Y')] = Number(f.pm25calibrated,'000')
Push(chartNames, f.time_stamp)
}
return {
type: 'test',
title : 'test',
description : 'Chart showing prior hours of AQI values',
attributes : chartValues, // replace this dictionary with your own key-value pairs,
mediaInfos: [{
type : 'linechart', //linechart | barchart | piechart | columnchart
//title : '',
//caption : '',
altText : 'line chart prior hours of AQI values', //altText will be read by screen readers
value : {
fields: chartNames, // choose what attributes to use in the chart
//normalizeField : '', // the name of the attribute to normalize by or value
}
}]
}